[klibc] Fix segfault on ppc

Jeff Bailey jbailey at ubuntu.com
Thu Dec 8 18:29:38 PST 2005


The SVR4 ABI PPC supplement isn't considered canonical on Linux.
Instead this arch uses the LSB ABI documents.  r7 is not guaranteed to
be initialised to any particular value, and the termination function
pointer is not provided at all.

I still have a couple more archs to test, don't rush out 1.1.5 yet. ;)

--- klibc-1.1.3.orig/klibc/arch/ppc/crt0.S
+++ klibc-1.1.3/klibc/arch/ppc/crt0.S
@@ -12,9 +12,12 @@
        /*
         * the SVR4abippc.pdf specifies r7 as a pointer to
         * a termination function pointer.
-        * It is unused on Linux.
+         * However, Section 8.4.1 of the LSB API docs say that
+         * The value to be placed into register r7, the termination
+         * function pointer, is not passed to the process.
+         * So we stub it out, instead.
         */
-       mr      4,7
+       li      4,0
        bl      __libc_init

        .size _start,.-_start


* Canonical Ltd * Ubuntu Service and Support * +1 514 691 7221 *

Linux for Human Beings.



More information about the klibc mailing list