Linker and Libraries Guide

Remove Unused Material

Including functions and data that is not used by the shared object or its dependencies is wasteful. This material bloats the shared object and can cause unnecessary relocation overhead and paging activity. References to unused dependencies are also wasteful. These references result in the unnecessary loading and processing of other shared objects.

Unused material is displayed during a link-edit when using any of the link-editors debugging tokens, or the basic token -D basic. Material identified as unused should be removed from the link-edit, or eliminated using the link-editors -z ignore option.

The link-editor identifies a section from a relocatable object as unused if:

Sections that match these criteria are eliminated from the shared object being built with the -z ignore option. You can improve the link-editors ability to eliminate sections by defining the shared objects external interfaces, and by refining a sections content with compiler options such as -xF. If all allocatable sections from a relocatable object can be eliminated, the entire file is discarded from link-edit.

The link-editor identifies a shared object dependency as unused if it is not bound to by the shared object being produced. These unused dependencies are not recorded in the shared object being built with the -z ignore option.