Skip to content

Commit ada63d4

Browse files
Ard BiesheuvelRussell King
authored andcommitted
ARM: 8300/1: teach __asmeq that r11 == fp and r12 == ip
The __asmeq macro is used inside inline asm statements to ensure that register asm variables that explicitly specify a register are mapped correctly onto those registers when used in inline asm input and output constraints. However, the string based matching fails to take into account that 'fp' is often referred to as 'r11' and 'ip' is often referred to as 'r12', (e.g., by clang), causing false negatives. Fix this by making __asmeq consider the ("fp","r11"), ("r11","fp"), ("ip","r12") and ("r12","ip") cases specifically. Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 7a06192 commit ada63d4

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎arch/arm/include/asm/compiler.h‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,21 @@
88
* This string is meant to be concatenated with the inline asm string and
99
* will cause compilation to stop on mismatch.
1010
* (for details, see gcc PR 15089)
11+
* For compatibility with clang, we have to specifically take the equivalence
12+
* of 'r11' <-> 'fp' and 'r12' <-> 'ip' into account as well.
1113
*/
12-
#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
14+
#define __asmeq(x, y) \
15+
".ifnc " x "," y "; " \
16+
".ifnc " x y ",fpr11; " \
17+
".ifnc " x y ",r11fp; " \
18+
".ifnc " x y ",ipr12; " \
19+
".ifnc " x y ",r12ip; " \
20+
".err; " \
21+
".endif; " \
22+
".endif; " \
23+
".endif; " \
24+
".endif; " \
25+
".endif\n\t"
1326

1427

1528
#endif /* __ASM_ARM_COMPILER_H */

0 commit comments

Comments
 (0)