summaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/nptl-fix-unwind_resume-plt-calls.patch
blob: 2647af915a3a5c1f27361faa0082a04cec51b3c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
My change a49b3a18e463cbe8c94c41501e386e7f4c61609e fixed two
Unwind_Resume calls to go via PLT to avoid text relocations for PIC
builds. However, it looks the reason for upstream not using PLT calls
is that ebx gets clobbered. So we need to reload it.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
 .../sysv/linux/i386/i486/pthread_cond_timedwait.S  |    4 ++++
 .../unix/sysv/linux/i386/i486/pthread_cond_wait.S  |   18 +++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

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
index ac7983c..3b61367 100644
--- 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
@@ -648,6 +648,10 @@ __condvar_tw_cleanup:
 
 	movl	%esi, (%esp)
 .LcallUR:
+#ifdef __PIC__
+	call	__i686.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+#endif
 	call	_Unwind_Resume@PLT
 	hlt
 .LENDCODE:
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
index abc963f..a1294c5 100644
--- 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
@@ -535,6 +535,10 @@ __condvar_w_cleanup:
 
 	movl	%esi, (%esp)
 .LcallUR:
+#ifdef __PIC__
+	call	__i686.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+#endif
 	call	_Unwind_Resume@PLT
 	hlt
 .LENDCODE:
@@ -569,14 +573,14 @@ __condvar_w_cleanup:
 .Lcstend:
 
 #ifdef __PIC__
-	.section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits
-	.globl	__i686.get_pc_thunk.cx
-	.hidden	__i686.get_pc_thunk.cx
-	.type	__i686.get_pc_thunk.cx,@function
-__i686.get_pc_thunk.cx:
-	movl (%esp), %ecx;
+	.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+	.globl	__i686.get_pc_thunk.bx
+	.hidden	__i686.get_pc_thunk.bx
+	.type	__i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+	movl (%esp), %ebx;
 	ret
-	.size	__i686.get_pc_thunk.cx,.-__i686.get_pc_thunk.cx
+	.size	__i686.get_pc_thunk.bx,.-__i686.get_pc_thunk.bx
 #endif
 
 #ifdef SHARED
-- 
1.7.1