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

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

问题描述

我正在尝试在链接时加载符号文件.我提供了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.

  • 1st,我提供的符号文件与 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.

第二,我稍微改变了格式.我添加了 # 在文件的开头,并进行了更改以遵循 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 一个 __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天全站免登陆