Tools to modify shared libraries

Marcel Moolenaar marcel at xcllnt.net
Tue Jun 17 09:51:34 PDT 2003


On Tue, Jun 17, 2003 at 09:31:54AM -0700, Joe Kelsey wrote:
> Marcel Moolenaar wrote:
> >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.
> >
> 
> I know of no way to do this in the case of shared libraries.  When 
> linking shared libraries, the linker *cannot* resolve any references to 
> other shared libraries other than list them in the .dynamic section with 
> some sort of tag such as DT_NEEDED.  Please explain to me how the linker 
> can prune the shared library list at link time.

If a symbol is unresolved, it must be present in one of the libraries
on the link line. If the symbol is in an archive library, you pull in
the code. Otherwise, if it's in a shared library, you record the
dependency on that library.

In the end you have no unresolved symbols, all code from archives has
been linked in and you have a complete list of dependencies that is a
subset of the libraries given on the command line.

For partial linking (incremental linking) the list of unresolved
symbols does not have to be empty.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel at xcllnt.net


More information about the freebsd-questions mailing list