|
|||||||||||
Technical Support On-Line Manuals Linker User Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Elimination of unused sections
4.3 Elimination of unused sectionsElimination of unused sections is the most significant optimization on image size that is performed by the linker. Unused section elimination:
To control this optimization use the
--remove ,
--no_remove , --first , --last , and
--keep linker options.Unused section elimination requires an entry point. Therefore, if there is no entry point
specified for an image, use the
--entry linker option to specify an entry
point and permit unused section elimination to work, if it is enabled.Use the
--info unused linker option to instruct the linker to generate a
list of the unused sections that it eliminates.An input section is retained in the final image when:
NoteCompilers usually collect functions and data together and emit one
section for each category. The linker can only eliminate a section if it is entirely
unused.
You can mark a function or variable in source code with the
__attribute__((used)) attribute. This causes armcc to generate the symbol __tagsym$$used for each of the functions and variables. A section containing a
definition of __tagsym$$used is not removed by unused
section elimination.You can also use the
--split_sections
compiler command-line option to instruct the compiler to generate one ELF section for each
function in the source file.Related conceptsRelated reference | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.