While future gas versions will allow line number information to be
generated for all instances of .irp and alike [1][2], the same isn't
true (nor immediately intended) for .macro [3]. Hence macros, when they
do more than just invoke another macro or issue an individual insn, want
to have .line directives (in header files also .file ones) in place.

Signed-off-by: Jan Beulich <[email protected]>

[1] 
https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=7992631e8c0b0e711fbaba991348ef6f6e583725
[2] 
https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=2ee1792bec225ea19c71095cee5a3a9ae6df7c59
[3] 
https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=6d1ace6861e999361b30d1bc27459ab8094e0d4a
---
Using .file has the perhaps undesirable side effect of generating a fair
amount of (all identical) STT_FILE entries in the symbol table. We also
can't use the supposedly assembler-internal (and hence undocumented)
.appfile anymore, as it was removed [4]. Note that .linefile (also
internal/undocumented) as well as the "# <line> <file>" constructs the
compiler emits, leading to .linefile insertion by the assembler, aren't
of use anyway as these are processed and purged when processing .macro
[3].

[4] 
https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=c39e89c3aaa3a6790f85e80f2da5022bc4bce38b

--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -24,6 +24,8 @@
 #include <asm/msr-index.h>
 #include <asm/spec_ctrl.h>
 
+#define FILE_AND_LINE .file __FILE__; .line __LINE__
+
 /*
  * Saving and restoring MSR_SPEC_CTRL state is a little tricky.
  *
@@ -89,6 +91,7 @@
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
+    FILE_AND_LINE
 /*
  * Requires nothing
  * Clobbers \tmp (%rax by default), %rcx
@@ -137,6 +140,7 @@
 .endm
 
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
+    FILE_AND_LINE
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
  * Requires %r14=stack_end (if maybexen)
@@ -171,6 +175,7 @@
 .endm
 
 .macro DO_SPEC_CTRL_EXIT_TO_XEN
+    FILE_AND_LINE
 /*
  * Requires %rbx=stack_end
  * Clobbers %rax, %rcx, %rdx
@@ -192,6 +197,7 @@
 .endm
 
 .macro DO_SPEC_CTRL_EXIT_TO_GUEST
+    FILE_AND_LINE
 /*
  * Requires %eax=spec_ctrl, %rsp=regs/cpuinfo
  * Clobbers %rcx, %rdx
@@ -241,6 +247,7 @@
  * been reloaded.
  */
 .macro SPEC_CTRL_ENTRY_FROM_INTR_IST
+    FILE_AND_LINE
 /*
  * Requires %rsp=regs, %r14=stack_end
  * Clobbers %rax, %rcx, %rdx
@@ -288,6 +295,7 @@ UNLIKELY_DISPATCH_LABEL(\@_serialise):
 
 /* Use when exiting to Xen in IST context. */
 .macro SPEC_CTRL_EXIT_TO_XEN_IST
+    FILE_AND_LINE
 /*
  * Requires %rbx=stack_end
  * Clobbers %rax, %rcx, %rdx
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -12,6 +12,7 @@
 #include <asm/asm_defns.h>
 
 .macro IND_THUNK_RETPOLINE reg:req
+        .line __LINE__
         call 2f
 1:
         lfence


Reply via email to