Illegal instruction gcc assembler.
- by Bernt
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..)