From 3560961878b15be5ecad9cb0ea61cfb17f1da990 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 10 Jan 2007 22:18:39 +0000 Subject: merge from blackfin.uclinux.org: Adjust crt1.S so that __uClibc_main is called properly --- libc/sysdeps/linux/bfin/crt1.S | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/bfin/crt1.S b/libc/sysdeps/linux/bfin/crt1.S index ffbd6e9af..156654437 100644 --- a/libc/sysdeps/linux/bfin/crt1.S +++ b/libc/sysdeps/linux/bfin/crt1.S @@ -83,6 +83,7 @@ __start: L3 = 0; #ifdef __ID_SHARED_LIB__ + /* We know we have a local copy, so we can avoid the GOT. */ CALL ___shared_flat_add_library; #endif /* Load register R1 (argc) from the stack to its final resting place */ @@ -92,24 +93,15 @@ __start: /* Copy argv pointer into R2 -- which its final resting place */ R2 = P0; -/* Skip to the end of argv and put a pointer to the environment in - [SP + 12] */ - R3 = R1; - R3 <<= 2; - R3 += 4; - R3 = R2 + R3; - - P2 = SP; - SP += -32; - [SP + 12] = R3; + SP += -28; #ifndef __BFIN_FDPIC__ R7 = 0; #endif /* Pass highest stack pointer to the app. */ - [SP + 28] = P2; + [SP + 24] = P2; /* Store the pointer to ld.so's fini that we got in P1. */ - [SP + 24] = R7; + [SP + 20] = R7; /* Ok, now run uClibc's main() -- shouldn't return */ #if defined L_crt1 && defined __UCLIBC_CTOR_DTOR__ @@ -123,7 +115,8 @@ __start: R3.H = __init; R3.L = __init; #endif - [SP+16] = R3; + [SP+12] = R3; + #ifdef __BFIN_FDPIC__ R3 = [P3 + __fini@FUNCDESC_GOT17M4]; @@ -133,11 +126,11 @@ __start: R3.H = __fini; R3.L = __fini; #endif - [SP+20] = R3; + [SP+16] = R3; #else /* no ctor/dtor handling */ R3 = 0; + [SP + 12] = R3; [SP + 16] = R3; - [SP + 20] = R3; #endif #ifdef __BFIN_FDPIC__ @@ -162,8 +155,8 @@ __start: .type lib_main,@function lib_main: RETS = [SP++]; - P0 = [P5 + ___shared_flat_add_library@GOT]; - JUMP (P0); + /* We know we have a local copy, so we can avoid the GOT. */ + JUMP.L ___shared_flat_add_library; .hidden _current_shared_library_p5_offset_ #endif -- cgit v1.2.3