9f8b9d8774ded15b5716e3be234c1b87915a38bb
[openwrt-10.03/.git] / toolchain / uClibc / patches-0.9.30.2 / 700-mips_nptl_dl_find_hash_fix.patch
1 From 9c343fd4030dcd7a52616f365893177dded50346 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Wed, 13 Jan 2010 01:51:32 +0000
4 Subject: mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS relocations.
5
6 Make use of macros from sys/asm.h in crt1.S
7 These two changes are needed for mips nptl to boot once again.
8
9 Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 ---
11 diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S
12 index e851d52..6a80412 100644
13 --- a/libc/sysdeps/linux/mips/crt1.S
14 +++ b/libc/sysdeps/linux/mips/crt1.S
15 @@ -85,29 +85,10 @@
16  
17  __start:
18  #ifdef __PIC__
19 -#if _MIPS_SIM == _MIPS_SIM_ABI32
20 -       .frame  sp, 24, sp
21 -        .set noreorder
22 -       move $0, $31            /* Save old ra.  */
23 -       bal 10f                 /* Find addr of cpload.  */
24 -        nop
25 -10:
26 -       .cpload $31
27 -       move $31, $0
28 -       .set reorder
29 -       .cprestore 16
30 -#else
31 -       move $0, $31; /* Save old ra.  */
32 -       .set noreorder
33 -       bal 10f /* Find addr of .cpsetup.  */
34 -       nop
35 -10:
36 -       .set reorder
37 -       .cpsetup $31, $25, 10b
38 -       move $31, $0
39 -#endif
40 +       SETUP_GPX($0)
41 +       SETUP_GPX64($25,$0)
42  #else
43 -       la $28, _gp             /* Setup GP correctly if we're non-PIC.  */
44 +       PTR_LA $28, _gp             /* Setup GP correctly if we're non-PIC.  */
45         move $31, $0
46  #endif
47  
48 @@ -118,18 +99,18 @@ __start:
49         /* Allocate space on the stack for seven arguments and
50          * make sure the stack is aligned to double words (8 bytes) */
51  
52 +       and $29, -2 * SZREG
53 +
54  #if _MIPS_SIM == _MIPS_SIM_ABI32
55 -       and $29, -2 * 4
56 -       subu $29, 32
57 -       la $7, _init            /* init */
58 -       la $8, _fini
59 -       sw $8, 16($29)          /* fini */
60 -       sw $2, 20($29)          /* rtld_fini */
61 -       sw $29, 24($29)         /* stack_end */
62 -#else
63 -       and $29, -2 * PTRSIZE
64 +       PTR_SUBIU $29, 32
65 +#endif
66         PTR_LA $7, _init                /* init */
67 -       PTR_LA $8, _fini                /* fini */
68 +       PTR_LA $8, _fini
69 +#if _MIPS_SIM == _MIPS_SIM_ABI32
70 +       PTR_S $8, 16($29)               /* fini */
71 +       PTR_S $2, 20($29)               /* rtld_fini */
72 +       PTR_S $29, 24($29)              /* stack_end */
73 +#else
74         move $9, $2             /* rtld_fini */
75         move $10, $29           /* stack_end */
76  #endif
77 @@ -148,4 +129,3 @@ __data_start:
78         .weak data_start
79         data_start = __data_start
80  
81 -
82 --
83 cgit v0.8.2.1