diff options
author | Stefan Agner <stefan@agner.ch> | 2019-03-23 07:09:49 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2019-04-23 12:20:51 -0400 |
commit | a6c9e96bf86b8aa86d8696b7887e52c2e95bac0f (patch) | |
tree | 64ab02244f143452b8bc8e6a1ca61264feac1181 | |
parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) |
ARM: 8851/1: add TUSERCOND() macro for conditional postfix
Unified assembly syntax requires conditionals to be postfixes.
TUSER() currently only takes a single argument which then gets
appended t (with translation) on every instruction.
This fixes a build error when using LLVM's integrated assembler:
In file included from kernel/futex.c:72:
./arch/arm/include/asm/futex.h:116:3: error: invalid instruction, did you mean: strt?
"2: " TUSER(streq) " %3, [%4]n"
^
<inline asm>:5:4: note: instantiated into assembly here
2: streqt r2, [r4]
^~~~~~
Additionally, for GCC ".syntax unified" for inline assembly.
When compiling non-Thumb2 GCC always emits a ".syntax divided"
at the beginning of the inline assembly which makes the
assembler fail. Since GCC 5 there is the -masm-syntax-unified
GCC option which make GCC assume unified syntax asm and hence
emits ".syntax unified" even in ARM mode. However, the option
is broken since GCC version 6 (see GCC PR88648 [1]). Work
around by adding ".syntax unified" as part of the inline
assembly.
[0] https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-masm-syntax-unified
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88648
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/include/asm/domain.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/futex.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h index 99d9f630d6b6..1888c2d15da5 100644 --- a/arch/arm/include/asm/domain.h +++ b/arch/arm/include/asm/domain.h | |||
@@ -133,9 +133,11 @@ static inline void modify_domain(unsigned dom, unsigned type) { } | |||
133 | * instructions (inline assembly) | 133 | * instructions (inline assembly) |
134 | */ | 134 | */ |
135 | #ifdef CONFIG_CPU_USE_DOMAINS | 135 | #ifdef CONFIG_CPU_USE_DOMAINS |
136 | #define TUSER(instr) #instr "t" | 136 | #define TUSER(instr) TUSERCOND(instr, ) |
137 | #define TUSERCOND(instr, cond) #instr "t" #cond | ||
137 | #else | 138 | #else |
138 | #define TUSER(instr) #instr | 139 | #define TUSER(instr) TUSERCOND(instr, ) |
140 | #define TUSERCOND(instr, cond) #instr #cond | ||
139 | #endif | 141 | #endif |
140 | 142 | ||
141 | #else /* __ASSEMBLY__ */ | 143 | #else /* __ASSEMBLY__ */ |
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h index 0a46676b4245..83c391b597d4 100644 --- a/arch/arm/include/asm/futex.h +++ b/arch/arm/include/asm/futex.h | |||
@@ -110,10 +110,11 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
110 | preempt_disable(); | 110 | preempt_disable(); |
111 | __ua_flags = uaccess_save_and_enable(); | 111 | __ua_flags = uaccess_save_and_enable(); |
112 | __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" | 112 | __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" |
113 | " .syntax unified\n" | ||
113 | "1: " TUSER(ldr) " %1, [%4]\n" | 114 | "1: " TUSER(ldr) " %1, [%4]\n" |
114 | " teq %1, %2\n" | 115 | " teq %1, %2\n" |
115 | " it eq @ explicit IT needed for the 2b label\n" | 116 | " it eq @ explicit IT needed for the 2b label\n" |
116 | "2: " TUSER(streq) " %3, [%4]\n" | 117 | "2: " TUSERCOND(str, eq) " %3, [%4]\n" |
117 | __futex_atomic_ex_table("%5") | 118 | __futex_atomic_ex_table("%5") |
118 | : "+r" (ret), "=&r" (val) | 119 | : "+r" (ret), "=&r" (val) |
119 | : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) | 120 | : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) |