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: