How should the GNU linker treat weak references?

Ulrich Drepper drepper@redhat.com
Mon Jul 2 12:41:00 GMT 2001


"H . J . Lu" <hjl@lucon.org> writes:

> But in Mark's case, it is crtbegin.o contains a weak reference to
> __register_frame_info_bases, which has a definition in the shared
> libgcc. Do we treat weak reference the same as undefined when dealing
> with DT_NEEDED?

There is no problem in this particular case.  Since the definition in
libgcc_s is seen the weak reference (weak or not) is fulfilled.  In
general, weak references are treated exactly like normal references in
ld with one exception: weak references for symbols from archives.
Making a decision here is not easy, argumentations for both sides are
valid and therefore I want to see a flag for ld to let the user
decide.  Solaris' ld has this.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Binutils mailing list