This test file segfaults ld: .text .globl _start _start: ret .weak foo .weak foow .hidden foow # These should both end up zero. .data .picptr funcdesc(foo) .picptr funcdesc(foow) sec is NULL at the top of _frvfdpic_emit_got_relocs_plt_entries. Discovered while cribbing from the FRV port for SH FDPIC - presumably both should be zero and have no relocations. That's what happens for the non-hidden one.
Created attachment 2694 [details] Add checks for a NULL section pointer
Hi Daniel, Does the uploaded patch work for you ? Cheers Nick
Subject: Re: Linker segfaults with undefined weak function descriptors. On Tue, Apr 15, 2008 at 02:18:14PM -0000, nickc at redhat dot com wrote: > Hi Daniel, > > Does the uploaded patch work for you ? It does fix the crash, but two unnecessary function descriptors appear to be allocated. And I get an assertion failure on elf32-frv.c:5867 if I add -shared to the link command (along with a corrupt relocation in .rel.dyn). If I link the executable with a shared library I get a dynamic reloc for the non-hidden undefweak symbol, which IMO is correct.
commit 906e58cab5ef included the attached patch, so segfault fixed.