|
因为嵌入式编程中,比较在意可执行代码的大小。
我用 --ffunction-sections --fdata-sections选项给让gcc将每个函数都放到一个独立的sections里面,然后用
- /* the program code is stored in the .text section, which goes to Flash */
- .text :
- {
- . = ALIGN(4);
-
- *(.text) /* remaining code */
- *(.text.*) /* remaining code */
- *(.rodata) /* read-only data (constants) */
- *(.rodata*)
- *(.glue_7)
- *(.glue_7t)
- . = ALIGN(4);
- _etext = .;
- /* This is used by the startup in order to initialize the .data secion */
- _sidata = _etext;
- } >FLASH
-
复制代码
这样的连接脚本控制连接过程,但gcc还是将每一个函数都连接到了最后的结果中去了,有没有办法让gcc只连接需要的函数呢?谢谢。 |
|