toolchain/uClibc: apply an upstream 0.9.32 patch (Unwind_Resume calls to go via PLT...
[librecmc/librecmc.git] / toolchain / uClibc / patches-0.9.32 / 000-upstream-Unwind_Resume_PLT_calls_fix.patch
1 From 1f674977c0f3ea1e67deea93fa8f4e795cc869ad Mon Sep 17 00:00:00 2001
2 From: Timo Teräs <timo.teras@iki.fi>
3 Date: Tue, 07 Dec 2010 09:27:29 +0000
4 Subject: nptl: fix Unwind_Resume PLT calls
5
6 My change a49b3a18e463cbe8c94c41501e386e7f4c61609e fixed two
7 Unwind_Resume calls to go via PLT to avoid text relocations for PIC
8 builds. However, it looks the reason for upstream not using PLT calls
9 is that ebx gets clobbered. So we need to reload it.
10
11 Signed-off-by: Timo Teräs <timo.teras@iki.fi>
12 Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
13 ---
14 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
15 index ac7983c..3b61367 100644
16 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
17 +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
18 @@ -648,6 +648,10 @@ __condvar_tw_cleanup:
19  
20         movl    %esi, (%esp)
21  .LcallUR:
22 +#ifdef __PIC__
23 +       call    __i686.get_pc_thunk.bx
24 +       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
25 +#endif
26         call    _Unwind_Resume@PLT
27         hlt
28  .LENDCODE:
29 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
30 index abc963f..a1294c5 100644
31 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
32 +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
33 @@ -535,6 +535,10 @@ __condvar_w_cleanup:
34  
35         movl    %esi, (%esp)
36  .LcallUR:
37 +#ifdef __PIC__
38 +       call    __i686.get_pc_thunk.bx
39 +       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
40 +#endif
41         call    _Unwind_Resume@PLT
42         hlt
43  .LENDCODE:
44 @@ -569,14 +573,14 @@ __condvar_w_cleanup:
45  .Lcstend:
46  
47  #ifdef __PIC__
48 -       .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits
49 -       .globl  __i686.get_pc_thunk.cx
50 -       .hidden __i686.get_pc_thunk.cx
51 -       .type   __i686.get_pc_thunk.cx,@function
52 -__i686.get_pc_thunk.cx:
53 -       movl (%esp), %ecx;
54 +       .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
55 +       .globl  __i686.get_pc_thunk.bx
56 +       .hidden __i686.get_pc_thunk.bx
57 +       .type   __i686.get_pc_thunk.bx,@function
58 +__i686.get_pc_thunk.bx:
59 +       movl (%esp), %ebx;
60         ret
61 -       .size   __i686.get_pc_thunk.cx,.-__i686.get_pc_thunk.cx
62 +       .size   __i686.get_pc_thunk.bx,.-__i686.get_pc_thunk.bx
63  #endif
64  
65  #ifdef SHARED
66 --
67 cgit v0.8.2.1