Mach-O 64位格式不支持32位绝对地址。NASM访问阵列
使用命令从我的Mac计算机上运行此代码:
nasm -f macho64 -o max.a maximum.asm
这是我试图在我的计算机上运行的代码,它找到数组中最大的数字。
section .datadata_items: dd 3,67,34,222,45,75,54,34,44,33,22,11,66,0 section .textglobal _start_start: mov edi, 0 mov eax, [data_items + edi*4] mov ebx, eaxstart_loop: cmp eax, 0 je loop_exit inc edi mov eax, [data_items + edi*4] cmp eax, ebx jle start_loopmov ebx, eaxjmp start_looploop_exit:mov eax, 1int 0x80
错误:
maximum.asm:14: error: Mach-O 64-bit format does not support 32-bit absolute addressesmaximum.asm:21: error: Mach-O 64-bit format does not support 32-bit absolute addresses