From 4401cfb819df129c749a9408762a8152e3faaa7d Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 20 Jan 2004 17:44:17 +0000 Subject: Paul Mundt writes: The current behavior of the powerpc boot1_arch.h seems somewhat broken. Currently room is made on the stack pointer for the link register, but the link register is never actually pushed onto it. glibc bears the following comments: /* Call _dl_start with one parameter pointing at argc */ mr r3,r1 /* (we have to frob the stack pointer a bit to allow room for _dl_start to save the link register). */ followed by the -16 add to r1. Despite the fact that r1 is modified, the link register is never actually pushed onto r1, thus the adjustment is completely superfluous. There's two possible fixes for this, either saving the link register in the way that glibc does, or getting rid of the r1 adjustment. As I'm not sure if saving the link register will actually break the _dl_boot2 callin, both options will probably want to be played with. The following bit of inline assembly in the attached patch builds cleanly for me with gcc 3.3 on darwin, but I'm not able to test it any further beyond that. --- ldso/ldso/powerpc/boot1_arch.h | 4 +++- ldso/ldso/powerpc/dl-startup.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/powerpc/boot1_arch.h b/ldso/ldso/powerpc/boot1_arch.h index 615db6926..2f54ed9d9 100644 --- a/ldso/ldso/powerpc/boot1_arch.h +++ b/ldso/ldso/powerpc/boot1_arch.h @@ -9,8 +9,10 @@ asm("" \ " .text\n" \ " .globl _dl_boot\n" \ "_dl_boot:\n" \ -" mr 3,1\n" \ +" mr 3,1\n" \ +" li 4,0\n" \ " addi 1,1,-16\n" \ +" stw 4,0(1)\n" \ " bl _dl_boot2\n" \ ".previous\n" \ ); diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h index 615db6926..2f54ed9d9 100644 --- a/ldso/ldso/powerpc/dl-startup.h +++ b/ldso/ldso/powerpc/dl-startup.h @@ -9,8 +9,10 @@ asm("" \ " .text\n" \ " .globl _dl_boot\n" \ "_dl_boot:\n" \ -" mr 3,1\n" \ +" mr 3,1\n" \ +" li 4,0\n" \ " addi 1,1,-16\n" \ +" stw 4,0(1)\n" \ " bl _dl_boot2\n" \ ".previous\n" \ ); -- cgit v1.2.3