1
votes

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

1
Perhaps you mean section .text and section .data?tc.
Yes, that's just a typo in my question.Matt Fichman
Which version of nasm are you using? I haven't been able to reproduce this with the one shipped with Xcode 4.1 Lion.tc.
The version of NASM that ships with Xcode doesn't seem to support 64-bit assembly.Matt Fichman

1 Answers

-1
votes

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.