开发者

Segmentation Fault when compiling in Red hat but working fine with ubuntu

Here is a code that i am executing. its giving the desired output on ubuntu with NASM 2.08 but gives a segmentation fault when compiled with Red Hat 7.3 running NASM 0.98.22 Can someone help me by telling how i can make sure it runs fine on red hat too.

section .data

section .text
    global _start
_start:

xor eax,eax
cdq
push eax
push long 0x68732f2f
开发者_如何学JAVApush long 0x6e69622f
mov ebx,esp
push eax
push eax
mov ecx,esp
mov al,0xb
push eax
int 0x80


Your code is 32 bit so when you build it you need to make sure that you build a 32 bit executable. This will happen by default on your 32 bit OS but you probably need a switch like -m32 to achieve this on a 64 bit OS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜