Development Reference Guides


Exclude Unused Code and Data from the Executable

Programs often contain dead code or data that is not used during their execution. Even if no expensive whole-program inter-procedural analysis is made at compile time to identify dead code, there are compiler options you can specify to eliminate unused functions and data at link time.
This method is often referred to as function-level linking.
Options to specify:
, --
Some of the options in the above specifications are passed to the linker.
Advantages of this method:
Only the code that is referenced remains in an executable. Dead functions and data are stripped from the executable.
Disadvantages of this method:
  • The object codes may become slightly larger because each function or datum is put into a separate section. The overhead is eliminated at the linking stage.
  • This method requires linker support to strip unused sections.
  • This method can slightly increase linking time.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at