将静态库答案放在Flash节的开头 [英] placing static library answer in the beginning of flash section

查看:203
本文介绍了将静态库答案放在Flash节的开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用atmelstudio编译固件映像,并希望将静态库(包括gnu的libc.a和libgcc.a)中的功能放在.text部分的开头,然后.text属于我的项目源代码.现在发生的是相反的情况.

I'm using atmelstudio to compile a firmware image and want to place the functions from static libraries (including the gnu's libc.a & libgcc.a) in the beginning of the .text section followed .text belong to my project source code. Right now what happen is the other way around.

这是我的链接描述文件

    . = ALIGN(4);
    _sfixed = .;
    KEEP(*(.vectors .vectors.*))
    *(.text .text.* .gnu.linkonce.t.*)    <-- my functions and functions from static libraries are within this rule
    *(.glue_7t) *(.glue_7)
    *(.rodata .rodata* .gnu.linkonce.r.*)
    *(.ARM.extab* .gnu.linkonce.armextab.*)

推荐答案

*(.text)中的星号表示匹配任何目标文件.您需要为libc命名并放在第一位.这些在Gnu ld手册中称为输入节.根据手册的语法为libc.a:(.text),您可以使用libc.a:strcmp.o(.text)对库中的特定对象进行排序.

The star in *(.text), means to match any object file. You need to give the name for the libc and put it first. These are called input sections in the gnu ld manual. The syntax according to the manual is libc.a:(.text), you may order specific objects within a library, with libc.a:strcmp.o(.text).

请参阅: Gnu Ld第3.6.4.1节输入节基础" 有关详细信息.

See: Gnu Ld section 3.6.4.1 Input Section Basics for detailed information.

一个解决方案可能是

KEEP(*(.vectors .vectors.)) 
.a:(.text .text. .rodata .rodata*) <-- this line 
*(.text .text. .gnu.linkonce.t.*) 
*(.glue_7t) *(.glue_7) 
*(.rodata .rodata .gnu.linkonce.r.*)

这篇关于将静态库答案放在Flash节的开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆