简体   繁体   English

意外的链接描述文件符号地址

[英]Unexpected linker script symbol address

I am using gcc-arm-none-eabi 4.9 2014q4 to do my linking and the symbol addresses are not coming out the way I would expect and need for init. 我正在使用gcc-arm-none-eabi 4.9 2014q4进行链接,并且符号地址未按我期望的方式和初始化所需的方式输出。

My linker script attempts to create the following sections: 我的链接器脚本尝试创建以下部分:

MEMORY
{
    SRAM_L (rwx) : ORIGIN = 0x00000000, LENGTH = 32K
    SRAM_U (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
}

SECTIONS
{
    .vectors 0x00000000 :
    {
        *o(.vectors_)
    }

    .text :
    {
        . = ALIGN (4);
        *(.text);
        _etext = . ;
    }

    . = . ;
    .data 0x20000000 : 
     AT ( ADDR(.text) + SIZEOF ( .text ) )
    {
        . = ALIGN (4);
        _data = . ; *(.data); _edata = . ;
    }

    .bss : 
     AT ( ADDR(.data) + SIZEOF ( .data ) )
    {
        . = ALIGN (4);
        _bss = . ; *(.bss) *(COMMON); _ebss = . ;
    }

    . = ALIGN (4);
    . += 8;

    free_memory_start = .;
    _end_of_stack = .;
    end = .;
    _start_of_heap = .;
    . = 0x20007000;
    _start_of_stack = .;
    _end_of_heap = .;

}

Because of my configuration I now need to relocate the data and zero the bss. 由于我的配置,我现在需要重定位数据并将bss归零。 When i look at the symbol table the values are incorrect... 0x20000000 _data 0x20000000 _edata 当我查看符号表时,值不正确... 0x20000000 _data 0x20000000 _edata

It looks from the map like the .data is not being place in the .data section? 从地图上看起来好像.data不在.data节中?

.data           0x20000000        0x0 load address 0x00000814
                0x20000000                . = ALIGN (0x4)
                0x20000000                _data = .
 *(.data)
                0x20000000                _edata = .

.igot.plt       0x00003c30        0x0 load address 0x20000000
 .igot.plt      0x00000000        0x0 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/armv7e-m/crtbegin.o

.data.impure_data
                0x00003c30      0x428
 .data.impure_data
                0x00003c30      0x428 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-impure.o)

.data._impure_ptr
                0x00004058        0x4
 .data._impure_ptr
                0x00004058        0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-impure.o)
                0x00004058                _impure_ptr

.data.__malloc_av_
                0x0000405c      0x408
 .data.__malloc_av_
                0x0000405c      0x408 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
                0x0000405c                __malloc_av_

.data.__malloc_trim_threshold
                0x00004464        0x4
 .data.__malloc_trim_threshold
                0x00004464        0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
                0x00004464                __malloc_trim_threshold

.data.__malloc_sbrk_base
                0x00004468        0x4
 .data.__malloc_sbrk_base
                0x00004468        0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
                0x00004468                __malloc_sbrk_base

.data.base      0x0000446c        0x4
 .data.base     0x0000446c        0x4 ./src/hardware/iomux-v3.o

.data.heap      0x00004470        0x4
 .data.heap     0x00004470        0x4 ./src/sys.o
                0x00004470                heap

.data.lc_ctype_charset
                0x00004474       0x20
 .data.lc_ctype_charset
                0x00004474       0x20 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-locale.o)

.data.__mb_cur_max
                0x00004494        0x4
 .data.__mb_cur_max
                0x00004494        0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-locale.o)
                0x00004494                __mb_cur_max

.data.__wctomb  0x00004498        0x4
 .data.__wctomb
                0x00004498        0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-wctomb_r.o)
                0x00004498                __wctomb

Have I somehow gotten my wildcards wrong for the data definition? 我是否为数据定义弄错了通配符?

Thx, Devan Thx德文

Your wildcards are not matching .data.* . 您的通配符不匹配.data.* Put the following in the data section: 将以下内容放入数据部分:

*(.data .data.*)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过链接描述文件在特定地址处放置符号? - How to place a symbol at certain address trough the linker script? 如何在 IAR linker 脚本中定义总图像大小或其结束地址的符号? - How to define a symbol for total image size or its end address in IAR linker script? 将符号从C文件导入链接描述文件 - Importing a symbol from C file into linker script 无法分配链接描述文件中定义的变量的地址 - Cannot assign address of variable defined in linker script gcc链接器描述文件强制符号位于特定地址 - gcc linker description file force symbol to be at specific address 链接描述文件:在生成的代码中插入函数的绝对地址 - Linker script: insert absolute address of the function to the generated code 无法在 linker 脚本中计算段的结束地址 - Can't calculate end address of the section at linker script 如何使用链接描述文件指定特定部分的内存地址? - How do I specify the memory address for a specific section with a linker script? 如果链接脚本中未定义节,则虚拟内存地址错误 - Wrong Virtual Memory Address if section is not defined in the linker script 为什么我的 linker 脚本中的 ENTRY() 没有被设置为. =<address> 部分?</address> - Why is the ENTRY() in my linker script not being set to the . = <address> section?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM