]> xenbits.xensource.com Git - xen.git/commitdiff
build32: don't discard .shstrtab in linker script
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 24 Jun 2020 15:14:40 +0000 (17:14 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Jun 2020 15:14:40 +0000 (17:14 +0200)
LLVM linker doesn't support discarding .shstrtab, and complains with:

ld -melf_i386_fbsd -N -T build32.lds -o reloc.lnk reloc.o
ld: error: discarding .shstrtab section is not allowed

Add an explicit .shstrtab, .strtab and .symtab sections to the linker
script after the text section in order to make LLVM LD happy and match
the behavior of GNU LD.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
master commit: 10d27b48b5b4dfbead2d9bf03290984bba4806e4
master date: 2020-06-02 13:37:53 +0200

xen/arch/x86/boot/build32.lds

index 97454b40ff4939177e9e496a76935d05d158991b..1ab941879312ffee7336013ac8174b6317e4e939 100644 (file)
@@ -50,6 +50,20 @@ SECTIONS
         *(.got.plt)
   }
 
+  /*
+   * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigger an
+   * error. Also keep the rest of the control sections to match GNU LD behavior.
+   */
+  .shstrtab : {
+        *(.shstrtab)
+  }
+  .strtab : {
+        *(.strtab)
+  }
+  .symtab : {
+        *(.symtab)
+  }
+
   /DISCARD/ : {
         /*
          * Discard everything else, to prevent linkers from putting