【发布时间】:2011-09-27 05:59:36
【问题描述】:
这是我正在执行的代码。它使用 NASM 2.08 在 ubuntu 上提供所需的输出,但在使用运行 NASM 0.98.22 的 Red Hat 7.3 编译时会出现分段错误 有人可以告诉我如何确保它在 red hat 上也能正常运行。
section .data
section .text
global _start
_start:
xor eax,eax
cdq
push eax
push long 0x68732f2f
push long 0x6e69622f
mov ebx,esp
push eax
push eax
mov ecx,esp
mov al,0xb
push eax
int 0x80
【问题讨论】:
-
一个平台是 64 位,另一个平台是 32 位吗?您是否尝试过在调试器(例如 gdb)下运行?
-
是的。我的 ubuntu 是 64 位的,而红帽是 32 位的,这会是个问题吗?我该如何解决?
-
请添加您用于构建可执行文件的命令行
-
$nasm -f elf test3.s $ld -m elf_i386 -s -o test3 test3.o
标签: linux x86 intel nasm redhat