Message ID | 20200528144023.10814-3-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Clang/LLVM build fixes | expand |
On 28.05.2020 16:40, Roger Pau Monne wrote: > 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 Well, yes, GNU ld is more intelligent and doesn't extend the discarding to the control sections in the first place. All of .symtab, .strtab, and .shstrtab are still there. > Add an explicit .shstrtab section to the linker script after the text > section in order to make LLVM LD happy. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Assuming the change was tested to not confuse GNU ld Acked-by: Jan Beulich <jbeulich@suse.com> I wouldn't mind extending this to the other two control sections named above. In case the binaries need picking apart, them being present is surely helpful. Jan
On Fri, May 29, 2020 at 05:45:44PM +0200, Jan Beulich wrote: > On 28.05.2020 16:40, Roger Pau Monne wrote: > > 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 > > Well, yes, GNU ld is more intelligent and doesn't extend the > discarding to the control sections in the first place. All > of .symtab, .strtab, and .shstrtab are still there. > > > Add an explicit .shstrtab section to the linker script after the text > > section in order to make LLVM LD happy. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > Assuming the change was tested to not confuse GNU ld > Acked-by: Jan Beulich <jbeulich@suse.com> Yes, it's been tested on the gitlab CI, no issues reported on any of the builds: https://gitlab.com/xen-project/people/royger/xen/pipelines/151009839 > I wouldn't mind extending this to the other two control > sections named above. In case the binaries need picking > apart, them being present is surely helpful. I don't mind extending, it might make sense in case linkers start complaining about trying to discard those too. Thanks, Roger.
diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds index 97454b40ff..5bd42ee4d9 100644 --- a/xen/arch/x86/boot/build32.lds +++ b/xen/arch/x86/boot/build32.lds @@ -50,6 +50,11 @@ SECTIONS *(.got.plt) } + .shstrtab : { + /* Discarding .shstrtab is not supported by LLD (LLVM LD). */ + *(.shstrtab) + } + /DISCARD/ : { /* * Discard everything else, to prevent linkers from putting
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 section to the linker script after the text section in order to make LLVM LD happy. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- xen/arch/x86/boot/build32.lds | 5 +++++ 1 file changed, 5 insertions(+)