[uClibc] ldso 0.9.21, libstdc++ crashes on PowerPC GCC 3.3.1

Joakim Tjernlund joakim.tjernlund at lumentis.se
Mon Oct 6 08:07:27 UTC 2003


> On Mon Oct 06, 2003 at 09:20:09AM +0200, Joakim Tjernlund wrote:
> > I browsed the uClib WWW CVS to find memcpy and friends and I did not find them.
> 
> uClibc/libc/string/wstring.c

I found a Wmemcpy. I suppose this is what you ment. It is very slow.

> 
> > I suspect these are impl. in C somewhere. Is there a reason why these aren't in
> > assembler? It would be easy to rip these from the kernel.
> 
> The kernel is GPL while uClibc is LGPL.  So while we can borrow
> code from things like glibc, we cannot borrow kernel code.

Ahh, I see.

Maybe this memcpy will do, which is inspired by the kernel memcpy but I wrote
it myself as a test.

	.globl memcpy
memcpy:
	srwi.	r7,r5,3
	addi	r6,r3,-4
	addi	r4,r4,-4
	li	r9,4
	beq	2f
	andi.	r0,r6,3
	mtctr	r7
	bne-	3f		/* word align destination */
1:	lwz	r7,4(r4)
	lwzu	r8,8(r4)
	stw	r7,4(r6)
	stwu	r8,8(r6)
	bdnz	1b
	andi.	r5,r5,7
2:	or.	r5,r5,r5
	beqlr
	mtxer	r5
	lswx	r7,r9,r4
	stswx	r7,r9,r6
	blr
3:	mtxer	r0
	lswx	r7,r9,r4
	subf	r5,r0,r5
	add	r4,r4,r0
	stswx	r7,r9,r6
	add	r6,r6,r0
	rlwinm.	r7,r5,32-3,3,31
	beq	2b
	mtctr	r7
	b	1b




More information about the uClibc mailing list