clone() bug for Thumb-2 target?

Sergei Poselenov sposelenov at emcraft.com
Tue Jun 7 15:44:52 UTC 2011


Hello,

I'm working with a Cortex-M3 target device and noticed that 0.9.31
clone() doesn't work. The library .config enables CONFIG_ARM7TDMI=y.

Putting aside the 2.6.33 Cortex-M3 kernel bugs, the
following code in libc/sysdeps/linux/arm/clone.S looks strange to me:
#if defined(THUMB1_ONLY)
...
#else
...
	@ pick the function arg and call address off the stack and execute
        ldr     r0, [sp, #4]
	mov     lr, pc
^^^^^^^^^^^^^^^^^^^^^^^^^
        ldr     pc, [sp]

        @ and we are done, passing the return value through r0
        b       HIDDEN_JUMPTARGET(_exit)
#endif


Where the clone() function returns? In my case, it crashes on the
"ldr pc, [sp]", as far as I can see.

Why not to use
mov r1, [sp]
blx r1

?

This works.


Could someone clarify?

Regards,
Sergei


More information about the uClibc mailing list