UnderOverLinkProblems

Underlinking
Underlinking is the situation when ELF shared library contains unresolved symbols. Underlinking causes the following problems:


 * Full link is performed by the final binary linking. At this stage all the knowledge about compatible versions of libraries and their symbol versioning is already lost, so it may result in runtime errors, when dynamic loader loads incompatible versions of libraries or libraries with incompatible symbol versioning.
 * It's not possible to prelink underlinked libraries.
 * It's not possible to link with underlinked libraries in --as-needed mode.

Sources of Underlinking

 * Errors in makefiles.

Overlinking
Overlinking is linking ELF shared library or executable with the libraries which are not used directly by the library/binary itself. This causes the following problems:


 * Unused libraries waste process (and sometimes system) memory.
 * Unused libraries slow down dynamic linker.
 * Unused libraries result in the excessive packages inderdependencies, which makes library transitions long and painful. Excessive dependencies also may waste disk space.
 * Dependencies to the different versions of the same library in the resulting binary may result in loading several versions of the same library simultaneously which may cause runtime errors.

Sources of Overlinking

 * Libraries providing wrong pkg-config or /usr/bin/*-config files.

Resources

 * How to write shared libraries
 * freetype transition nightmare in Debian
 * ALT Linux:
 * Discussion in sisyphus mailing list (russian): 1 2
 * Russian wiki page
 * Mandriva Wiki:
 * Underlinking
 * Overlinking
 * Gentoo:
 * http://www.gentoo.org/proj/en/qa/asneeded.xml