bee*_*sem 5 x86 assembly gcc nasm
我正在使用Kali linux 64位,我正在尝试从Paul Carter博士的网站执行以下程序.gcc命令给出错误.我应该在gcc命令中使用什么?
nasm -f elf32 array1.asm
root@kali:assembly# gcc -o array1 array1.o array1c.c
array1c.c:9:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
array1c.c:10:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
/usr/bin/ld: i386 architecture of input file `array1.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
您正在尝试将32位目标文件链接i386到64位可执行文件(i386:x86-64).添加-m32到gcc编译行以创建32位可执行文件.
小智 5
nasm -f elf64 array1.asm
Run Code Online (Sandbox Code Playgroud)
然后
ld -s -o array1 array1.o
Run Code Online (Sandbox Code Playgroud)