STM32,ARM,Keil工具相关

One ELF Section per Function

https://blog.csdn.net/iceiilin/article/details/6091575

因此,可以得出,选项One ELF Section per Function的主要功能是对冗余函数的优化。通过这个选项,可以在最后生成的二进制文件中将冗余函数排除掉(虽然其所在的文件已经参与了编译链接),以便最大程度地优化最后生成的二进制代码。

而该选项实现的机制是将每一个函数作为一个优化的单元,而并非整个文件作为参与优化的单元。

选项One ELF Section per Function所具有的这种优化功能特别重要,尤其是在对于生成的二进制文件大小有严格要求的场合。人们习惯将一系列接口函数放在一个文件里,然后将其整个包含在工程中,即使这个文件将只有一个函数被用到。这样,最后生成的二进制文件中就有可能包含众多的冗余函数,造成了宝贵存储空间的浪费。

 The One ELF Section per Function option tells the compiler to put all functions into their own individual ELF

sections. This allows the linker to remove unused functions.

An ELF code section typically contains the code for a number of functions. The linker is normally only able to remove

unused ELF sections, not unused functions. An ELF section can only be removed if all its contents are unused.

Therefore, splitting each function into its own ELF section allows the compiler to easily identify which ones are unused,

and remove them.

Selecting this option increases the time required to compile your code, but results in improved performance.

猜你喜欢

转载自www.cnblogs.com/yanhc/p/12238197.html