PIE禁用。在mac OS X上使用gcc进行asm编程时的绝对寻址

时间:2014-09-01 18:09:34

标签: macos gcc assembly

我写了这段代码。我想在mac OS X上用gcc编译它。 但它似乎'PIE禁用。当我运行gcc时,绝对寻址。

我用Google搜索了,但我找不到解决方案。 请建议我。

hello.s

.data
hello: .string "Hello World!\n"

.text
.globl _main

_main:
    push %rbp
    mov %rsp, %rbp
    movabs $hello, %rdi
    call _printf
    leave
    ret

错误

ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in
code signed PIE, but used in _main from /var/folders/xs/4z9kr_n93111fhv9_j1dd9gw0000gn/T/ex2_64-369300.o. 
To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie

0 个答案:

没有答案