Tools to modify shared libraries

Marcel Moolenaar marcel at
Tue Jun 17 09:23:04 PDT 2003

On Tue, Jun 17, 2003 at 09:13:04AM -0700, Joe Kelsey wrote:
> >>>It's more constructive to fix the linker than it is to patch the
> >>>ELF files created by it. The linker knows which libraries are
> >>>really needed and should be able to create the minimal list of
> >>>(true) dependencies.
> >>
> >>This cannot be accomplished by fixing the linker.  The issue is one of 
> >>attempting to use a *linux* shared library in a native application. 
> >
> >
> >Linux uses the same linker (GNU ld). Fixing the linker will have the
> >same effect on Linux as it will have on FreeBSD and hence will prevent
> >unnecessary dependencies in Linux libraries to Linux libraries and
> >thus remove the need to patch ELF files in the long run.
> >
> The problem cannot be resolved by "fixing" ld.  The problem arises from 
> people who specify unnecessary libraries on their ld command lines.  ld 
> cannot tell the difference between a required library and an unnecessary 
> library at link time.

Yes it can. Symbol resolution is a fundamental part in linking.
Hence, the linker has all the information it needs to filter the
gratuitously long list of libraries programmers tend to give it
and keep the libraries that actually contributed to the link.

 Marcel Moolenaar	  USPA: A-39004		 marcel at

More information about the freebsd-questions mailing list