Linker User GuidePreface Overview of the Linker Linking Models Supported by armlink Image Structure and Generation Linker Optimization Features Elimination of common debug sections Elimination of common groups or sections Elimination of unused sections Elimination of unused virtual functions About linker feedback Example of using linker feedback Optimization with RW data compression How the linker chooses a compressor Options available to override the compression algo How compression is applied Considerations when working with RW data compressi Function inlining with the linker Factors that influence function inlining About branches that optimize to a NOP Linker reordering of tail calling sections Restrictions on reordering of tail calling section Linker merging of comment sections Getting Image Details Accessing and Managing Symbols with armlink Scatter-loading Features Scatter File Syntax Linker Command-line Options Linker Steering File Command Reference Via File Syntax
Elimination of unused virtual functions
4.4 Elimination of unused virtual functions
Unused virtual function elimination is a refinement of unused section elimination.
Unused section elimination efficiently removes unused functions from C code. In C++ applications, virtual functions and RunTime Type Information (RTTI) objects are referenced by pointer tables, known as vtables. Without extra information, the linker cannot determine which vtable entries are accessed at runtime. This means that the standard unused section elimination algorithm used by the linker cannot guarantee to remove unused virtual functions and RTTI objects. Virtual Function Elimination (VFE) is a refinement of unused section elimination to reduce ROM size in images generated from C++ code. You can use this optimization to eliminate unused virtual functions and RTTI objects from your code.
An input section that contains more that one function can only be eliminated if all the functions are unused. The linker cannot remove unused functions from within a section.
VFE is a collaboration between the ARM® compiler and the linker whereby the compiler supplies extra information about unused virtual functions that is then used by the linker. Based on this analysis, the linker is able to remove unused virtual functions and RTTI objects.
For VFE to work, the linker requires all objects using C++ to have VFE annotations. If the linker finds a C++ mangled symbol name in the symbol table of an object and VFE information is not present, it turns off the optimization.
The compiler places the extra information in sections with names beginning
Related Knowledgebase Articles
of your data.