x86: remove alternative_callN usage of ALTERNATIVE asm macro
PATCH v3 1/1 x86: remove alternative_callN usage of ALTERNATIVE asm macro
There is a bug in llvm that needs to be fixed before switching to use the alternative assembly macros in inline assembly call sites. Therefore alternative_callN using inline assembly to generate the alternative patch sites should be using the ALTERNATIVE C preprocessor macro rather than the ALTERNATIVE assembly macro. Using the assembly macro in an inline assembly instance triggers the following bug on llvm based toolchains:
<instantiation>:1:1: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (... ^
<instantiation>:1:37: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<inline asm>:1:2: note: while in macro instantiation
ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM
^
<instantiation>:1:156: error: invalid symbol redefinition
...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p:
^
<instantiation>:18:5: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^
<instantiation>:18:26: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^<instantiation>:1:1: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (... ^
<instantiation>:1:37: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<inline asm>:1:2: note: while in macro instantiation
ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM
^
<instantiation>:1:156: error: invalid symbol redefinition
...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p:
^
<instantiation>:18:5: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^
<instantiation>:18:26: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^<instantiation>:1:1: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (... ^
<instantiation>:1:37: error: invalid symbol redefinition
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<inline asm>:1:2: note: while in macro instantiation
ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM
^
<instantiation>:1:156: error: invalid symbol redefinition
...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p:
^
<instantiation>:18:5: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^
<instantiation>:18:26: error: invalid symbol redefinition
.L0_repl_s1: call .; .L0_repl_e1:
^This has been reported to upstream llvm:
https://bugs.llvm.org/show_bug.cgi?id=42034
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Further fixes to commit log.
Changes since v1:
- Fix subject and commit message.
--- xen/include/asm-x86/alternative.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
xen/include/asm-x86/alternative.h +2 -3
@@ -202,9 +202,8 @@ extern void alternative_branches(void);rettype ret_; \ registerunsigned long r10_ asm("r10" ); \ registerunsigned long r11_ asm("r11" ); \ - asm volatile (__stringify(ALTERNATIVE "call *%c[addr](%%rip)", \ - "call .", \ - X86_FEATURE_ALWAYS) \ + asm volatile (ALTERNATIVE("call *%c[addr](%%rip)", "call .", \ + X86_FEATURE_ALWAYS) \ : ALT_CALL ## n ## _OUT, "=a" (ret_), \ "=r" (r10_), "=r" (r11_) ASM_CALL_CONSTRAINT \ : [addr] "i" (&(func)), "g" (func) \
Signature · 7 lines
2.20.1 (Apple Git-117) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 88 lines
Quoted 1 line
Quoted 1 line · On 29.05.19 at 18:13, <[email protected]> wrote:
There is a bug in llvm that needs to be fixed before switching to use the alternative assembly macros in inline assembly call sites. Therefore
alternative_callNusing inline assembly to generate the alternative patch sites should be using the ALTERNATIVE C preprocessor macro rather than the ALTERNATIVE assembly macro. Using the assembly macro in an inline assembly instance triggers the following bug on llvm based toolchains:<instantiation>:1:1: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:37: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^ <inline asm>:1:2: note: while in macro instantiation ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM ^ <instantiation>:1:156: error: invalid symbol redefinition ...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p: ^ <instantiation>:18:5: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^ <instantiation>:18:26: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^<instantiation>:1:1: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:37: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^ <inline asm>:1:2: note: while in macro instantiation ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM ^ <instantiation>:1:156: error: invalid symbol redefinition ...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p: ^ <instantiation>:18:5: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^ <instantiation>:18:26: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^<instantiation>:1:1: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...
^
<instantiation>:1:37: error: invalid symbol redefinition .L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^<instantiation>:1:60: error: invalid reassignment of non-absolute variable '.L0_diff'
.L0_orig_s: call *genapic+64(%rip); .L0_orig_e: .L0_diff = (.L0_repl_e1 - .L0_repl_s1) - (...^ <inline asm>:1:2: note: while in macro instantiation ALTERNATIVE "call *genapic+64(%rip)", "call .", X86_FEATURE_LM ^ <instantiation>:1:156: error: invalid symbol redefinition ...- (.L0_orig_e - .L0_orig_s); mknops ((-(.L0_diff > 0)) * .L0_diff); .L0_orig_p: ^ <instantiation>:18:5: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^ <instantiation>:18:26: error: invalid symbol redefinition .L0_repl_s1: call .; .L0_repl_e1: ^
Quoted 6 lines
This has been reported to upstream llvm:
https://bugs.llvm.org/show_bug.cgi?id=42034
Fixes 67d01cdb5 ("x86: infrastructure to allow converting certain indirect calls to direct ones")Signed-off-by Roger Pau Monné <[email protected]>
Well, hesitantly,
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel