How to force nasm to address variables position-independent?
问题 How to tell NASM (or LD) to process labels in a way that will make the segment position-independent? The segment is going to be moved from one file to another and I want it to work properly on any position in any file. Here is the code that illustrates my problem: section .text ... message: db 'hello world!',0x00 ... mov rax,SYSCALL_WRITE mov rdi,STDOUT mov rsi,message mov rdx,13 syscall In the orginal executable it prints "Hello world!", but when the segment is moved to another elf, it