[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] x86: improve .debug_line contents for assembly sources


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 12 Apr 2022 12:27:34 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pjldoVbWk4dOoIvq/Xe9YOBnGVbnNaI2DQunigbNhnw=; b=NB7uN0u/S2p4uLXyb4L68sZqtmZfpc2Bja0To7DY2xzoTKNV0Np7DnYrJ8j+XywiTGl1/GeRMQvEpS9mPJXvkeSvWinFZk5gjX2L0njf7CIRCosLHDVBP+PM1gOvyJlu+AzFhrMQ00Au8C4i7jgrwdI7fFOoKydFeE4AAKYz11TKOE1svHLa57YkRWK2C8D9z9HRFBJUJ6v0OPh02bPrqp14Quu5Fkx0rCeAQqenpzh4d8Cg5THo8DXEB0pX+WmsAIVczTpQxfFoZwbbHv2SjyNWcnpHM2sPepiGLS5BWNf71+ttUmdugmCYvvLIuVb1A9IHAu+d0/1PE9YEap8S9w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLd7WcPhzCqHZ5EC+x1II3oUv4hDAeYSjf/1gLBcgWZ5SX0urld8vq5kDaqfDdHQJvtkSDd3rsVwyaludxlVuxBv9Lj5TZREGv9aLJ5utugrNQGvJS/P1aRn83bPNU8SsmGDzbYXo9AQ1sKXBwdcfTTdLYGeemOHl17AsuYplepCtWNahnW3FTT/vOZgSj9B5zs8gqnNjgZsUjXt+p/vYfjYixFpJpAQ1RO5n/jaSlCIDzY94vqiz+xxYzsnoYglXh0vwJYl73nZijDsiYKberCVNsdx+YoyE1nhTunf17n/61nGYb8Urzuh7jd4pJ1kaVv0qieOHTCKnx4jZ2Pvng==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 12 Apr 2022 10:27:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <jbeulich@xxxxxxxx>

[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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.