Keil™, An ARM® Company

RealView Linker and Utilities Guide

Unused section elimination

3.3.3. Unused section elimination

Unused section elimination removes code that is never executed, or data that is not referred to by the code, from the final image. This optimization can be controlled by the ‑‑remove, ‑‑no_remove, ‑‑first, ‑‑last, and ‑‑keep linker options. Use the ‑‑info unused linker option to instruct the linker to generate a list of the unused sections that have been eliminated.

Unused section elimination is suppressed in those cases that might result in the removal of all sections.

An input section is retained in the final image under the following conditions:

  • if it contains an entry point

  • if it is referred to, directly or indirectly, by a non weak reference from an input section containing an entry point

  • if it is specified as the first or last input section by the ‑‑first or ‑‑last option (or a scatter-loading equivalent)

  • if it is marked as unremovable by the ‑‑keep option.

Note

Unused section elimination is a property of all groups, not just common groups.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0377A