- 论坛徽章:
- 20
|
本帖最后由 nswcfd 于 2016-03-31 17:07 编辑
按照as里对减法的定义,结果是个绝对地址(not relocatable)
`-'
"Subtraction". If the right argument is absolute, the result
has the section of the left argument. If both arguments are
in the same section, the result is absolute. You may not
subtract arguments from different sections.
感觉这个表达式(trampoline_data - r_base )应该是个负数(在16bit下就是比较靠近0xFFFF的地方)或者是0?
当然另外一种看法是吧rbase看作一个偏移,那结果就是在trapoline_data附近的一个地址,不过感觉不像是这样。
asm("head: nop; nop; end = .; nop; nop; mov $(end-2), %rax; mov $(end-head), %rax");
其中的end-2是相对地址,而end-head是绝对地址。 |
|