* ld.bfd 2.37 SEGV. x86_64 EFI app.
[not found] <320793a9-8a24-a5e5-35f3-9799925bc37c@t2data.com>
@ 2021-11-17 13:38 ` Christian Melki
2021-11-17 13:50 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Christian Melki @ 2021-11-17 13:38 UTC (permalink / raw)
To: binutils
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.
Found elf_i386_fake_section handling the COFF reloc object but no
similar function for x86_64. Am I missing something here? I tried adding
a fake section handling for x86_64, but that didn't help. Any hints on
why it chokes like this?
Regards,
Christian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ld.bfd 2.37 SEGV. x86_64 EFI app.
2021-11-17 13:38 ` ld.bfd 2.37 SEGV. x86_64 EFI app Christian Melki
@ 2021-11-17 13:50 ` H.J. Lu
2021-11-18 7:20 ` Alan Modra
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2021-11-17 13:50 UTC (permalink / raw)
To: Christian Melki; +Cc: Binutils
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?
> Found elf_i386_fake_section handling the COFF reloc object but no
> similar function for x86_64. Am I missing something here? I tried adding
> a fake section handling for x86_64, but that didn't help. Any hints on
> why it chokes like this?
>
> Regards,
> Christian
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ld.bfd 2.37 SEGV. x86_64 EFI app.
2021-11-17 13:50 ` H.J. Lu
@ 2021-11-18 7:20 ` Alan Modra
0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2021-11-18 7:20 UTC (permalink / raw)
To: H.J. Lu; +Cc: Christian Melki, Binutils
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-18 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <320793a9-8a24-a5e5-35f3-9799925bc37c@t2data.com>
2021-11-17 13:38 ` ld.bfd 2.37 SEGV. x86_64 EFI app Christian Melki
2021-11-17 13:50 ` H.J. Lu
2021-11-18 7:20 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).