ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
5.4 Elimination of unused virtual functions<br />
5.4.1 See also<br />
<strong>Using</strong> linker optimizations<br />
Unused section elimination efficiently removes unused functions from C code. In C++<br />
applications, virtual functions and RunTime Type <strong>Information</strong> (RTTI) objects are referenced by<br />
pointer tables, known as vtables. Without extra information, <strong>the</strong> linker cannot determine which<br />
vtable entries are accessed at runtime. This means that <strong>the</strong> standard unused section elimination<br />
algorithm used by <strong>the</strong> linker cannot guarantee to remove unused virtual functions and RTTI<br />
objects.<br />
Virtual Function Elimination (VFE) is a refinement of unused section elimination to reduce<br />
ROM size in images generated from C++ code. This optimization can be used to eliminate<br />
unused virtual functions and RTTI objects from your code.<br />
An input section that contains more that one function can only be eliminated if all <strong>the</strong> functions<br />
are unused. The linker cannot remove unused functions from within a section.<br />
VFE is a collaboration between <strong>the</strong> <strong>ARM</strong> compiler and <strong>the</strong> linker whereby <strong>the</strong> compiler supplies<br />
extra information about unused virtual functions that is <strong>the</strong>n used by <strong>the</strong> linker. Based on this<br />
analysis, <strong>the</strong> linker is able to remove unused virtual functions and RTTI objects.<br />
Note<br />
For VFE to work, <strong>the</strong> assembler requires all objects using C++ to have VFE annotations. If <strong>the</strong><br />
linker finds a C++ mangled symbol name in <strong>the</strong> symbol table of an object and VFE information<br />
is not present, it turns off <strong>the</strong> optimization.<br />
The compiler places <strong>the</strong> extra information in sections with names beginning .arm_vfe. These<br />
sections are ignored by <strong>the</strong> linker when it is not VFE-aware.<br />
Concepts<br />
• Elimination of common debug sections on page 5-2<br />
• Elimination of common groups or sections on page 5-3<br />
• Elimination of unused sections on page 5-4.<br />
Reference<br />
<strong>Linker</strong> Reference:<br />
• --vfemode=mode on page 2-186.<br />
<strong>Compiler</strong> Reference:<br />
• --rtti, --no_rtti on page 3-182.<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 5-6<br />
ID080411 Non-Confidential