Illegal instruction gcc assembler.
Posted
by Bernt
on Stack Overflow
See other posts from Stack Overflow
or by Bernt
Published on 2010-05-16T18:57:39Z
Indexed on
2010/05/16
19:00 UTC
Read the original article
Hit count: 274
In assembler:
.globl _test
_test:
pushl %ebp
movl %esp, %ebp
movl $0, %eax
pushl %eax
popl %ebp
ret
Calling from c
main()
{
_test();
}
Compile:
gcc -m32 -o test test.c test.s
This code gives me illegal instruction sometimes and segment fault other times. In gdc i always get illegal instruction, this is just a simple test, i had a larger program that was working and suddenly after no apperant reason stopped working, now i always get this error even if i start from scratch like above.
I have narrowed it down to pushl %eax (or any other register....), if i comment out that line the code runs fine.
Any ideas? (I'm running the program at my universities linux cluster, so I have not changed any settings..)
© Stack Overflow or respective owner