--as-needed change wrt undefined weak symbols

H.J. Lu hjl.tools@gmail.com
Thu Apr 4 17:16:00 GMT 2013


On Sun, Mar 17, 2013 at 7:41 PM, Alan Modra <amodra@gmail.com> wrote:
> http://sourceware.org/ml/binutils/2013-01/msg00188.html
>
> bfd/
>         PR ld/12549
>         elflink.c (elf_link_add_object_symbols): Exclude weak refs when
>         considering whether an --as-needed library is needed.
> ld/
>         * ld.texinfo (--as-needed): Update.
> ld/testsuite/
>         * ld-elf/pr14862.out: Expect no output.
>
> I'm committing the above patch.  Apologies to the bug reporter that
> it's taken so long.
>
> --
> Alan Modra
> Australia Development Lab, IBM

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.

-- 
H.J.



More information about the Binutils mailing list