This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: --as-needed change wrt undefined weak symbols


On Thu, Apr 04, 2013 at 10:15:58AM -0700, H.J. Lu wrote:
> On Sun, Mar 17, 2013 at 7:41 PM, Alan Modra <amodra@gmail.com> wrote:
> >         PR ld/12549
> >         elflink.c (elf_link_add_object_symbols): Exclude weak refs when
> >         considering whether an --as-needed library is needed.
> 
> Just for the record, this patch may change the behavior of
> the resulting executables for
> 
> extern void bar () __attribute__((weak));
> 
>   if (bar)
>     bar ();
> 
> if bar is defined in the DT_NEEDED library.  Binutils 2.22
> will resolve bar and add a DT_NEEDED entry.  The new
> linker will resolve bar to 0.  We will see if it causes any
> problems.

Your testcase in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56431
shows that gold resolves bar to zero, but on powerpc and powerpc64 ld
keeps bar dynamic.

Hmm, I see x86_64 ld resolves bar to 0.  Isn't this just an x86_64
backend ld bug?

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]