[已解决]Linux汇编初学者的问题
代码如下:section .text
global main
main:
mov eax,4
mov ebx,1
mov ecx,msg
mov edx,14
int 80h
mov eax,1
int 80h
msg:
db "Hello World!",0ah,0dh
编译运行:
nasm –f elf hello.asm
gcc –o hello hello.o
第一步没问题,
第二步出现错误:
/usr/bin/ld: i386 architecture of input file `hello.o' is incompatible with i386:x86-64 output
collect2: ld returned 1 exit status
我的机器是x86_64的环境,请问这个怎么解决阿。先谢谢了
[ 本帖最后由 破碎细胞 于 2008-3-3 15:19 编辑 ]
回复 #1 破碎细胞 的帖子
不清楚 nasm 是否可产生 64 位代码,若能,那你就要看看需要什么参数了回复 #2 mik 的帖子
呵呵,谢谢提示啊。我找了下,NASM确实对x86_64支持不好。
我换成了YASM
这样就可以了:
yasm -f elf64 hello.asm
gcc -o hello hello.o
页:
[1]