Linker optimizations
Virtual function elimination
Virtual Function Elimination (VFE) is a linker optimization that removes unneeded virtual functions and dynamic runtime type information.
In order for Virtual Function Elimination to work, all relevant modules must provide information about virtual function table layout, which virtual functions are called, and for which classes dynamic runtime type information is needed. If one or more modules do not provide this information, a warning is generated by the linker and Virtual Function Elimination is not performed.
Danger
If you know that modules that lack such information do not perform any virtual function calls and do not define any virtual function tables, you can use the ‑‑vfe=forced linker option to enable Virtual Function Elimination anyway.
Caution
In the IDE, select Project>Options>Linker>Optimizations>Perform C++ Virtual Function Elimination to enable this optimization.
Note
You can disable Virtual Function Elimination entirely by using the ‑‑no_vfe linker option. In this case, no warning will be issued for modules that lack VFE information.
Small function inlining
Small function inlining is a linker optimization that replaces some calls to small functions with the body of the function. This requires the body to fit in the space of the instruction that calls the function.
Caution
In the IDE, select Project>Options>Linker>Optimizations>Inline small routines to enable this optimization.
Danger
Use the linker option ‑‑inline.
Duplicate section merging
The linker can detect read-only sections with identical contents and keep only one copy of each such section, redirecting all references to any of the duplicate sections to the retained section.
Caution
In the IDE, select Project>Options>Linker>Optimizations>Merge duplicate sections to enable this optimization.
Danger
Use the linker option ‑‑merge_duplicate_sections.
Note
This optimization can cause different functions or constants to have the same address, so if your application depends on the addresses being different, for example, by using the addresses as keys into a table, you should not enable this optimization.