clone() bug for Thumb-2 target?

Sergei Poselenov sposelenov at emcraft.com
Thu Jun 9 07:39:27 UTC 2011


Hello,

On Wed, 8 Jun 2011 14:11:18 -0700
Khem Raj <raj.khem at gmail.com> wrote:

> On Tue, Jun 7, 2011 at 8:44 AM, Sergei Poselenov
> <sposelenov at emcraft.com> wrote:
> >
> > 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?
> >
> are those functionally equivalent ?

For my target - obviously not, original doesn't work, "blx" does.

> secondly blx does not exist on arch < ARMv5

Yes, I'm aware of this. Here is a code snippet with my fix:
...
#if defined(__USE_BX__)
	ldr     r1, [sp]
	blx     r1
#else   /* Old code - a bug? */
	mov     lr, pc
        ldr     pc, [sp]
#endif
...


I just wonder is the original code clone() proved to work on
not-THUMB1_ONLY uClibc configurations?

Regards,
Sergei


More information about the uClibc mailing list