| |||||||||||||
Technical Support On-Line Manuals RealView Linker and Utilities Guide | Unused function elimination
Virtual Function Elimination (VFE) is a refinement of unused section elimination to reduce ROM size in images generated from C++ code. This optimization can be used to eliminate unused virtual functions and RTTI objects from your code. If a function is compiled in its own section then VFE is synonymous with unused section elimination (see Unused section elimination). However, where an input section contains more that one function, it can only be eliminated if all the functions are unused. The linker cannot remove unused functions from within a section. In the rest of this section, it is assumed that functions are compiled in their own sections. Unused section elimination efficiently removes unused functions from C code. However, in C++ applications, unused sections and RTTI objects are referenced by pointer tables. This means that the elimination algorithm used by the linker cannot guarantee to remove sections and RTTI objects reliably. 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 sections reliably. This collaboration also enables the linker to remove RTTI objects. NoteAssembler source files do not require VFE annotations, provided that they do not reference the C++ libraries. This is because the linker assumes that no virtual function calls are made by object files that do not reference the C++ libraries. Similarly, C source files that are compiled with an old version of armcc can participate in VFE provided that they do not reference the C++ libraries. VFE operates in four modes:
The compiler places the extra information in sections with names beginning | ||||||||||||
| |||||||||||||