summary refs log tree commit diff
path: root/sysdeps/unix/i386/brk.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/i386/brk.S')
-rw-r--r--sysdeps/unix/i386/brk.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/unix/i386/brk.S b/sysdeps/unix/i386/brk.S
index f55ac7c775..f1717bbf8e 100644
--- a/sysdeps/unix/i386/brk.S
+++ b/sysdeps/unix/i386/brk.S
@@ -34,7 +34,16 @@ C_LABEL(__curbrk)
 .text
 SYSCALL__ (brk, 1)
 	movl 4(%esp), %eax
+#ifdef	PIC
+	/* Standard PIC nonsense to store into `__curbrk' through the GOT.  */
+	call here
+here:	popl %ecx
+	addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+	movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx
+	movl %eax, (%ecx)
+#else
 	movl %eax, C_SYMBOL_NAME(__curbrk)
+#endif
 	xorl %eax, %eax
 	ret