链接时加载符号文件 [英] Loading symbol file while linking

查看:119
本文介绍了链接时加载符号文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在链接时加载符号文件.我提供了symbol.txt文件以及我链接的其他库.这是我尝试的两件事.

I am trying to load a symbol file at the time of linking. I am providing the symbol.txt file along with other libraries that I link. These are the two things I tried.

  • 首先,我提供的符号文件与arm-none-eabi-nm的输出完全相同,但这在第1行本身返回了语法错误.

  • 1st, I provided the symbol file exactly as what was the output of arm-none-eabi-nm, but this returned with a syntax error on line 1 itself.

2,我稍微更改了格式.我在文件的开头添加了#< SYMDEFS >#,并进行了更改以遵循ARM的symdef文件格式.这给了我错误

2nd, I changed the format a bit. I added #< SYMDEFS ># at the beginning of the file and made the changes to follow ARM's symdef file format. This gave me the error

无法识别文件:无法识别文件格式 collect2.exe:错误:ld返回1退出状态

file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status

有人在将符号文件加载到链接器(arm-none-eabi-ld)方面有任何经验吗?如果是,请帮我弄清楚我在上面缺少什么.

Does anyone have any experience in loading symbol files to the linker (arm-none-eabi-ld)? If yes, please help me figure out what I am missing above.

我的符号文件的前几行如下:

The first few lines of my symbol file is as follows:

#< SYMDEFS>#";这里没有,我用它来删除标记
0x00000000 A __heap_size
0x00000000 R __vect_table
0x00000000 R __vector_table
0x00000074 A ___data_size

"#< SYMDEFS >#" ;There is no " here, I used it to remove the markup
0x00000000 A __heap_size
0x00000000 R __vect_table
0x00000000 R __vector_table
0x00000074 A ___data_size

我知道这种格式可用于armlink.

I know that this format works with armlink.

推荐答案

如果您使用的是GNU链接器,只需创建一个看起来像这样的文件并将其包含在链接器命令行中:

If you're using the GNU linker, just create a file that looks something like this and include it on the linker command line:

__intstk_top__ = __syspage_base__ + 0x2000;
__abortstk_top__ = __syspage_base__ + 0x3000;
__undefinedstk_top__ = __syspage_base__ + 0x4000;
__svcstk_top__ = __syspage_base__ + 0x6000;
__sysstk_top__ = __syspage_base__ + 0x8000;
__boot_pgd__ = __syspage_base__ + 0x8000;
__boot_pgd_physical__ = __syspage_physical_base__ + 0x8000;
__boot_pte0__ = __syspage_base__ + 0xC000;
__boot_pte0_physical__ = __syspage_physical_base__ + 0xC000;
__boot_pte1__ = __syspage_base__ + 0xD000;
__boot_pte1_physical__ = __syspage_physical_base__ + 0xD000;
__syspage_physical_base__ = 0x48000000;
__syspage_base__ = 0x80000000;
__syspage_size__ = 0xE000;
__device_base__ = 0xC0000000;
__user_limit__ = 0x7FFFFFFF;
__virtual_offset__ = 0x80000000 - __syspage_physical_base__;
__dev_offset__ = 0xC0000000;
__mmu_enabled__ = 1;
__kernel_base__ = __syspage_base__;

如您所见,这些符号可以定义为常量或可以在链接时解析的简单表达式.

As you can see, the symbols can be defined as constants or with simple expressions that can be resolved at link time.

这篇关于链接时加载符号文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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