您当前的位置: 首页 > 

mac os X 下用nasm大杂烩

发布时间:2013-05-08 17:50:31 ,浏览量:0

section .data
    msg db 'This is a test', 10, 0    ; something stupid here
    ft db 'addr is %x',10,0

section .text
    global _main
    extern _printf
    extern _exit

_main:
    push    rbp
    mov     rbp, rsp       

    ;xor     al, al
    mov     rdi, ft
    ;lea rdi,[rel ft]
    mov rsi,rdi
    call    _printf

	;xor rax,rax
	;mov [rax],rax

	xor rdi,rdi
	call _exit
    ;mov     rsp, rbp
    ;pop     rbp
    ret

mac OS X 10.8.3:

nasm -f macho x.asm

gcc -o x x.o

会出现警告:

ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _main from a.o. To fix this warning, don't compile

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    107766博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.2011s