开发者

Pointer to the text segment from the data segment

Is it possible to do the following with this relative addressing in x86-64?

section .text
two
   dq 0

section .data
one:
   dq two

When I do it this way on OS X with nasm, I get the following linker warning:

ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed 开发者_开发百科PIE, but used in one from /var/tmp/tmp.1.Ho4qKA. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie


Do what the warning says. PIE (position independent executable) is enabled, meaning that .text may be relocated in memory however the system likes, without modifying the code at all. The linker automatically detected this and disabled it for you, so relocations will happen as usual, allowing your constant addresses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜