Marcus Meissner did the ppc64 port, I did the update for crt0.S.
Now ash does not segfault, at least.
diff -p -purNx linux klibc-0.92.orig/Makefile klibc-0.92/Makefile
--- klibc-0.92.orig/Makefile 2003-12-01 18:50:24.000000000 +0000
+++ klibc-0.92/Makefile 2003-12-12 23:18:23.000000000 +0000
@@ -20,4 +20,4 @@ clean:
spotless:
@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
- rm -f klibc.spec
+ rm -f klibc.spec *~ tags
diff -p -purNx linux klibc-0.92.orig/klibc/arch/ppc64/Makefile.inc
klibc-0.92/klibc/arch/ppc64/Makefile.inc
--- klibc-0.92.orig/klibc/arch/ppc64/Makefile.inc 2002-08-13 04:04:47.000000000
+0000
+++ klibc-0.92/klibc/arch/ppc64/Makefile.inc 2003-12-12 21:54:45.000000000 +0000
@@ -7,4 +7,9 @@
# accordingly.
#
+ARCHOBJS = \
+ arch/$(ARCH)/setjmp.o
+
+ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
+
archclean:
diff -p -purNx linux klibc-0.92.orig/klibc/arch/ppc64/crt0.S
klibc-0.92/klibc/arch/ppc64/crt0.S
--- klibc-0.92.orig/klibc/arch/ppc64/crt0.S 2002-08-10 10:55:55.000000000 +0000
+++ klibc-0.92/klibc/arch/ppc64/crt0.S 2003-12-12 23:15:55.000000000 +0000
@@ -23,16 +23,10 @@ _start:
.globl ._start
.type ._start,@function
._start:
- ld 3,0(1)
- ld 4,8(1)
- ld 5,16(1)
- li 0,0
- stdu 0,-64(1)
- ld 9,.LC0@toc(2)
- std 5,0(9)
- bl .main
- nop
- bl .exit
+ stdu %r1,-32(%r1)
+ addi %r3,%r1,32
+ mr %r4,%r7 /* fini */
+ b .__libc_init
nop
.size _start,.-_start
diff -p -purNx linux klibc-0.92.orig/klibc/arch/ppc64/include/klibc/archsetjmp.h
klibc-0.92/klibc/arch/ppc64/include/klibc/archsetjmp.h
--- klibc-0.92.orig/klibc/arch/ppc64/include/klibc/archsetjmp.h 1970-01-01
00:00:00.000000000 +0000
+++ klibc-0.92/klibc/arch/ppc64/include/klibc/archsetjmp.h 2002-08-16
22:54:27.000000000 +0000
@@ -0,0 +1,36 @@
+/*
+ * arch/ppc/include/klibc/archsetjmp.h
+ */
+
+#ifndef _KLIBC_ARCHSETJMP_H
+#define _KLIBC_ARCHSETJMP_H
+
+struct __jmp_buf {
+ unsigned long __r2;
+ unsigned long __sp;
+ unsigned long __lr;
+ unsigned long __cr;
+ unsigned long __r13;
+ unsigned long __r14;
+ unsigned long __r15;
+ unsigned long __r16;
+ unsigned long __r17;
+ unsigned long __r18;
+ unsigned long __r19;
+ unsigned long __r20;
+ unsigned long __r21;
+ unsigned long __r22;
+ unsigned long __r23;
+ unsigned long __r24;
+ unsigned long __r25;
+ unsigned long __r26;
+ unsigned long __r27;
+ unsigned long __r28;
+ unsigned long __r29;
+ unsigned long __r30;
+ unsigned long __r31;
+};
+
+typedef struct __jmp_buf jmp_buf[1];
+
+#endif /* _SETJMP_H */
diff -p -purNx linux klibc-0.92.orig/klibc/arch/ppc64/setjmp.S
klibc-0.92/klibc/arch/ppc64/setjmp.S
--- klibc-0.92.orig/klibc/arch/ppc64/setjmp.S 1970-01-01 00:00:00.000000000
+0000
+++ klibc-0.92/klibc/arch/ppc64/setjmp.S 2003-11-25 05:49:26.000000000 +0000
@@ -0,0 +1,46 @@
+#
+# arch/ppc64/setjmp.S
+#
+# Basic setjmp/longjmp implementation
+# This file was derived from the equivalent file in NetBSD
+#
+
+ .text
+ .align 4
+
+ .section ".opd","aw"
+setjmp:
+ .quad .setjmp,.TOC.@tocbase,0
+ .previous
+ .size setjmp,24
+ .type .setjmp,@function
+ .globl setjmp
+ .globl .setjmp
+.setjmp:
+ mflr %r11 /* save return address */
+ mfcr %r12 /* save condition register */
+ mr %r10,%r1 /* save stack pointer */
+ mr %r9,%r2 /* save GPR2 (not needed) */
+ stmw %r9,0(%r3) /* save r9..r31 */
+ li %r3,0 /* indicate success */
+ blr /* return */
+
+ .size .setjmp,.-.setjmp
+ .section ".opd","aw"
+longjmp:
+ .quad .longjmp,.TOC.@tocbase,0
+ .previous
+ .size longjmp,24
+ .type .longjmp,@function
+ .globl longjmp
+ .globl .longjmp
+.longjmp:
+ lmw %r9,0(%r3) /* save r9..r31 */
+ mtlr %r11 /* restore LR */
+ mtcr %r12 /* restore CR */
+ mr %r2,%r9 /* restore GPR2 (not needed) */
+ mr %r1,%r10 /* restore stack */
+ mr %r3,%r4 /* get return value */
+ blr /* return */
+
+ .size .longjmp,.-.longjmp
diff -p -purNx linux klibc-0.92.orig/klibc/mmap.c klibc-0.92/klibc/mmap.c
--- klibc-0.92.orig/klibc/mmap.c 2002-11-15 05:07:50.000000000 +0000
+++ klibc-0.92/klibc/mmap.c 2003-12-12 21:54:45.000000000 +0000
@@ -19,7 +19,7 @@
* Prefer mmap2() over mmap(), except on the architectures listed
*/
-#if defined(__NR_mmap2) && !defined(__sparc__) &&
!defined(__ia64__)
+#if defined(__NR_mmap2) && !defined(__sparc__) &&
!defined(__ia64__) && !defined(__powerpc64__)
/* This architecture uses mmap2() */
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n?RNBERG