符号的绝对值 [英] Absolute value of symbol

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

问题描述

我正在尝试了解每次编译Linux内核时创建的System.map文件,我试图了解System.map文件中提供的值。

I was trying to understand the System.map file that gets created every time one compiles the Linux kernel, I was trying to understand the values presented in the System.map file.

以下是其中的示例信息

000001d5 A kexec_control_code_size
00400000 A phys_startup_32
c0400000 T _text
c0400000 T startup_32
c04000b4 T start_cpu0
c04000c4 T startup_32_smp
c04000e0 t default_entry
c0400158 t enable_paging
c04001da t is486`

如果看到第一行,符号的类型 kexec_control_code_size 显示为 A ,我知道 A 表示符号的值是绝对的,但我无法完全解码了什么意思。值是指符号的地址吗?绝对地址是否意味着每次内核加载到内存时,这个地址都会出现在这个地址上?

If you see the first line, the type of the symbol kexec_control_code_size is shown as A, I know that A means value of the symbol is absolute, but I wasn't able to completely decode what that exactly means. Does value mean the address of the symbol? Does absolute address mean that this symbol will be present at this address everytime the kernel gets loaded in to the memory?

请原谅,如果问题太基础了。

Please forgive, if the questions are too basic.

推荐答案

当链接器评估表达式时,结果是绝对的或相对于某个部分。相对表达式表示为与段的基数的固定偏移量。

When the linker evaluates an expression, the result is either absolute or relative to some section. A relative expression is expressed as a fixed offset from the base of a section.

链接描述文件中表达式的位置确定是绝对还是相对的。出现在输出部分定义中的表达式相对于输出部分的基数。在其他地方出现的表达式将是绝对的。

The position of the expression within the linker script determines whether it is absolute or relative. An expression which appears within an output section definition is relative to the base of the output section. An expression which appears elsewhere will be absolute.

如果使用-r选项请求可重新定位的输出,则设置为相对表达式的符号将可重定位。这意味着进一步的链接操作可以改变符号的值。符号的部分将是相对表达式的部分。

A symbol set to a relative expression will be relocatable if you request relocatable output using the -r option. That means that a further link operation may change the value of the symbol. The symbol's section will be the section of the relative expression.

设置为绝对表达式的符号将通过任何进一步的链接操作保留相同的值。该符号将是绝对的,不会有任何特定的关联部分。取自此手册

A symbol set to an absolute expression will retain the same value through any further link operation. The symbol will be absolute, and will not have any particular associated section. Taken from this manual

一个例子是这里。寻找行以下示例显示如何定义两个绝对符号定义。

An example is here. Look for line "The following example shows how two absolute symbol definitions can be defined. "

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

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