Nitin Garg wrote:
Hi, We are using ARM Cortex-A9 processor. The toolchain is gcc-4.4.0 with uClibc-0.9.30 and the kernel is 2.6.28. Using this toolchain when we build any application like "Hello World" and link it against pthread lib, the application does a segmentation fault when executed on target and gives "Illegal instruction" error message. I debugged the problem and it came out to be that "swp" instructions were disabled on the cortex-a9. The SWP instruction has been deprecated starting with the ARMv6 architecture. On newer ARMv7 processors, this instruction is disabled by default but it can be enabled by bit 10 in the System Control register. We can also build the kernel with CONFIG_OABI_COMPAT enabled. The real problem seems to be in the linuxthreads of uClibc where "swp" is being used for locks. Shall this not be replaced with ldrex/strex for ARMv7 onwards?
What on earth this problem has to do with GCC, does GCC produce the "swp" opcode although it shouldn't? For ARMv6 and onwards... Or do the uClibc sources have this opcode in inline asm code ? Then this problem should be discussed in some uClibc forum...