ld.bfd 2.37 SEGV. x86_64 EFI app.

Alan Modra amodra@gmail.com
Thu Nov 18 07:20:48 GMT 2021


On Wed, Nov 17, 2021 at 05:50:05AM -0800, H.J. Lu via Binutils wrote:
> On Wed, Nov 17, 2021 at 5:39 AM Christian Melki via Binutils
> <binutils@sourceware.org> wrote:
> >
> > Hi.
> >
> > Tried linking a 64-bit EFI app (U-Boot) which results in a SEGV in
> > ld.bfd (binutils 2.37):
> >
> >   Program received signal SIGSEGV, Segmentation fault.
> > 0x00005555555d1a8f in elf_x86_64_finish_dynamic_sections
> > (output_bfd=0x5555557fefa0, info=0x5555557fa140 <link_info>) at
> > /src/binutils/bfd/elf64-x86-64.c:4676
> > 4676            ->this_hdr.sh_entsize = htab->plt.plt_entry_size;
> > (gdb) bt
> > #0  0x00005555555d1a8f in elf_x86_64_finish_dynamic_sections
> > (output_bfd=0x5555557fefa0, info=0x5555557fa140 <link_info>) at
> > /src/binutils/bfd/elf64-x86-64.c:4676
> > #1  0x00005555556093ec in bfd_elf_final_link (abfd=<optimized out>,
> > info=<optimized out>) at /src/binutils/bfd/elflink.c:13116
> > #2  0x00005555555a4dd6 in ldwrite () at /src/binutils/ld/ldwrite.c:545
> > #3  0x000055555558c8f0 in main (argc=<optimized out>, argv=<optimized
> > out>) at /src/binutils/ld/ldmain.c:513
> >
> > (gdb) p (struct bfd_elf_section_data
> > *)(htab->elf.splt->output_section)->used_by_bfd
> > $3 = (struct bfd_elf_section_data *) 0x0
> >
> > This happens with earlier toolchains and ld.bfd versions too.
> 
> Please open a binutils bug.   Why don't grub2 x86-64 EFI applications
> run into this issue?

The segfault implies htab->elf.splt->output_section has a NULL
elf_section_data.  So .plt discarded by a linker script resulting in
output_section being bfd_abs_section_ptr.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list