Skip to content

Commit d689863

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/asm: Use %a instead of %P operand modifier in asm templates
The "P" asm operand modifier is a x86 target-specific modifier. For x86_64, when used with a symbol reference, the "%P" modifier emits "sym" instead of "sym(%rip)". This property is currently used to issue bare symbol reference. The generic "a" operand modifier should be used instead. The "a" asm operand modifier substitutes a memory reference, with the actual operand treated as address. For x86_64, when a symbol is provided, the "a" modifier emits "sym(%rip)" instead of "sym", enabling shorter %rip-relative addressing. Also note that unlike GCC, clang emits %rip-relative symbol reference with "P" asm operand modifier, so the patch also unifies symbol handling with both compilers. No functional changes intended. Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 41cd2e1 commit d689863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static __always_inline bool _static_cpu_has(u16 bit)
172172
ALTERNATIVE_TERNARY("jmp 6f", %c[feature], "", "jmp %l[t_no]")
173173
".pushsection .altinstr_aux,\"ax\"\n"
174174
"6:\n"
175-
" testb %[bitnum]," _ASM_RIP(%P[cap_byte]) "\n"
175+
" testb %[bitnum], %a[cap_byte]\n"
176176
" jnz %l[t_yes]\n"
177177
" jmp %l[t_no]\n"
178178
".popsection\n"

0 commit comments

Comments
 (0)