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

[xen staging] linker/lld: do not generate quoted section names



commit 702c9a800eb3ecd4b8595998d37a769d470c5bb0
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Mon May 2 08:51:45 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon May 2 08:51:45 2022 +0200

    linker/lld: do not generate quoted section names
    
    LLVM LD doesn't strip the quotes from the section names, and so the
    resulting binary ends up with section names like:
    
      [ 1] ".text"           PROGBITS         ffff82d040200000  00008000
           000000000018cbc1  0000000000000000  AX       0     0     4096
    
    This confuses some tools (like gdb) and prevents proper parsing of the
    binary.
    
    The issue has already been reported and is being fixed in LLD.  In
    order to workaround this issue and keep the GNU ld support define
    different DECL_SECTION macros depending on the used ld
    implementation.
    
    Drop the quotes from the definitions of the debug sections in
    DECL_DEBUG{2}, as those quotes are not required for GNU ld either.
    
    Fixes: 6254920587c3 ('x86: quote section names when defining them in linker 
script')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/xen.lds.S    | 6 +++++-
 xen/include/xen/xen.lds.h | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 6e4abbc1ce..d94915ea7d 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -20,7 +20,11 @@ ENTRY(efi_start)
 #else /* !EFI */
 
 #define FORMAT "elf64-x86-64"
-#define DECL_SECTION(x) #x : AT(ADDR(#x) - __XEN_VIRT_START)
+#ifdef CONFIG_LD_IS_GNU
+# define DECL_SECTION(x) x : AT(ADDR(#x) - __XEN_VIRT_START)
+#else
+# define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
+#endif
 
 ENTRY(start_pa)
 
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index fc47bb1ccc..06b7110837 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -18,11 +18,11 @@
  * for PE output, in order to record that we'd prefer these sections to not
  * be loaded into memory.
  */
-#define DECL_DEBUG(x, a) #x ALIGN(a) (NOLOAD) : { *(x) }
-#define DECL_DEBUG2(x, y, a) #x ALIGN(a) (NOLOAD) : { *(x) *(y) }
+#define DECL_DEBUG(x, a) x ALIGN(a) (NOLOAD) : { *(x) }
+#define DECL_DEBUG2(x, y, a) x ALIGN(a) (NOLOAD) : { *(x) *(y) }
 #else
-#define DECL_DEBUG(x, a) #x 0 : { *(x) }
-#define DECL_DEBUG2(x, y, a) #x 0 : { *(x) *(y) }
+#define DECL_DEBUG(x, a) x 0 : { *(x) }
+#define DECL_DEBUG2(x, y, a) x 0 : { *(x) *(y) }
 #endif
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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