2014-10-30 2 views
1

요세미티와 함께 ​​Macbook Pro를 사용하고 있습니다. printf가 작동하지 않습니다. 사용세분화 오류 호출 printf NASM

extern _printf 
global _main 

section .data 

msg: db  "Hello World" 

section .text 

_main: 
    push  msg 
    call  _printf 
    add   esp, 4 
    ret 

:

nasm -f macho test.s && gcc -arch i386 -e _main test.o && ./a.out 

는 출력 :

ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _main from test.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie 
Segmentation fault: 11 

난 정말 어떤 도움을 감사하겠습니다 여기에 내 코드입니다.

답변