This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: linker enhancements
On Fri, Dec 12, 2003 at 08:29:18AM -0800, Zack Weinberg wrote:
> > E.g. for libgcc_s for C dynamically linked programs which are using
> > -fexceptions (which is quite rare these days), GCC currently links
> > in libgcc_eh.a. It would be better to link against libgcc_s in that
> > case (so that there is just one unwinder etc.), on the other side
> > for the 99% of C dynamically linked programs which don't need it
> > linking against a shared library they don't use is a waste.
>
> I've suggested before that *all* shared libraries should get
> DT_NEEDED-ed into the executable only if they resolve undefined
> symbols - "just like" static libraries. (Check over your system and
> see how many applications load libnsl, though it's totally
> unnecessary, because they used AC_CHECK_LIB instead of AC_SEARCH_LIBS
> in their configure script.)
That would break a lot of programs which assume -lfoo means the library
will be in DT_NEEDED.
Which is why I think it should be user selectable. You could enable that
behaviour on the start of the cmd line for all libraries if you want, etc.
Jakub