0

I'm using buildroot. Compilation works fine, but binaries on target system says "Illegal instruction"

I have used strace:

execve("/opt/busybox", ["/opt/busybox"], [/* 8 vars */]) = 0 brk(0)
= 0 --- SIGILL {si_signo=SIGILL, si_code=ILL_ILLTRP, si_addr=0xa3f20} --- +++ killed by SIGILL +++ Illegal instruction

and then IDA.

The reason is SVC instruction (si_addr pointed to it in all binaries i tried)

What should i do to prevent using this instruction by GCC ?

artless noise
  • 21,212
  • 6
  • 68
  • 105
HardRock
  • 81
  • 1
  • 6
  • That's the `SuperVisor Call`, used for making system calls - you will need it. Problem might be then a mismatch between kernel and what you are trying to build. – auselen Mar 28 '13 at 09:57
  • Yes. Kernel already compiled and installed. I can't change it now :( also i dont have sources/configuration from exesting kernel. – HardRock Mar 28 '13 at 10:11
  • I retagged Linux (not SVC) that is some Microsoft web server thing and I tried to [update the wiki](http://stackoverflow.com/review/suggested-edits/1590553). I would investigate *EABI* versus *OABI*, this changes the `SVC/SWI` calling interface. See [trap.c](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/arch/arm/kernel/traps.c) You can boot with `user_debug=0xff` in the kernel *command line*. – artless noise Mar 28 '13 at 14:27
  • So, EABI is SVC and OABI is SWI ? – HardRock Mar 29 '13 at 11:19

1 Answers1

1

Looks like i have solved this problem.

The reason is EABI / OABI misconfiguration. Thanks to artless noise! I need OABI configuration.

Also, i really dont know why, but it start work only on GCC 4.3.x On default buildroot configuration of gcc 4.7.x eabi/oabi has no effect.

Finnaly, i set additional GCC options:

--with-march=armv5te --with-cpu=arm926ej-s --with-mtune=arm926ej-s --enable-multilib --disable-libssp --enable-languages=c,c++

HardRock
  • 81
  • 1
  • 6