about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/i386/clone.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/clone.S')
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index 7f758a52a8..0aec95e219 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -23,6 +23,7 @@
 #include <sysdep.h>
 #define _ERRNO_H	1
 #include <bits/errno.h>
+#include <asm-syntax.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
@@ -63,6 +64,12 @@ ENTRY(__clone)
 thread_start:
 	subl	%ebp,%ebp	/* terminate the stack frame */
 	call	*%ebx
+#ifdef PIC
+	call	L(here)
+L(here):
+	popl	%ebx
+	addl	$_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
+#endif
 	pushl	%eax
 	call	JUMPTARGET (_exit)