summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-08-23 15:44:52 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-08-23 15:44:52 +0000
commitf127b259c1cebc12296612d64c264890f7a7fe73 (patch)
treef412eaf234a9c01aa8c759b79e93f3713025a1e7
parent0662afb8abfec9f453fe8f7e3630011ab722e45e (diff)
Fetch the _GLOBAL_OFFSET_TABLE_ pointer in a way that's compatible with the
Secure-PLT ABI.
-rw-r--r--lib/libc/arch/powerpc/sys/brk.S10
-rw-r--r--lib/libc/arch/powerpc/sys/sbrk.S10
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/libc/arch/powerpc/sys/brk.S b/lib/libc/arch/powerpc/sys/brk.S
index d2d8a257e06..f027e7c3c8a 100644
--- a/lib/libc/arch/powerpc/sys/brk.S
+++ b/lib/libc/arch/powerpc/sys/brk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: brk.S,v 1.8 2012/08/22 22:26:16 deraadt Exp $ */
+/* $OpenBSD: brk.S,v 1.9 2015/08/23 15:44:51 kettenis Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
@@ -38,8 +38,10 @@ PREFIX2(brk,break)
ori 5,5,_C_LABEL(end)@l /* # 5 = &_end */
#else
mflr 10
- bl _GLOBAL_OFFSET_TABLE_@local-4
- mflr 9
+ bcl 20, 31, 1f
+1: mflr 9
+ addis 9, 9, _GLOBAL_OFFSET_TABLE_-1b@ha
+ addi 9, 9, _GLOBAL_OFFSET_TABLE_-1b@l
mtlr 10
lwz 5,_C_LABEL(end)@got(9)
#endif
@@ -62,7 +64,7 @@ PREFIX2(brk,break)
/* check for error */
cmpwi 0, 0
beq+ .L_brk_ok /* OK so this is stupid but I haven't read b */
- b PIC_PLT(_ASM_LABEL(__cerror))
+ b _ASM_LABEL(___cerror)
/* update, __curbrk and return */
.L_brk_ok:
diff --git a/lib/libc/arch/powerpc/sys/sbrk.S b/lib/libc/arch/powerpc/sys/sbrk.S
index c5a82d50093..1a581e184ae 100644
--- a/lib/libc/arch/powerpc/sys/sbrk.S
+++ b/lib/libc/arch/powerpc/sys/sbrk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbrk.S,v 1.7 2012/08/22 22:26:16 deraadt Exp $ */
+/* $OpenBSD: sbrk.S,v 1.8 2015/08/23 15:44:51 kettenis Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
@@ -46,8 +46,10 @@ PREFIX2(sbrk,break)
ori 6, 6, _ASM_LABEL(__curbrk)@L /* # 6 = &__curbrk */
#else
mflr 10
- bl _GLOBAL_OFFSET_TABLE_@local-4
- mflr 9
+ bcl 20, 31, 1f
+1: mflr 9
+ addis 9, 9, _GLOBAL_OFFSET_TABLE_-1b@ha
+ addi 9, 9, _GLOBAL_OFFSET_TABLE_-1b@l
mtlr 10
lwz 6,_ASM_LABEL(__curbrk)@got(9)
#endif
@@ -60,7 +62,7 @@ PREFIX2(sbrk,break)
/* check for error */
cmpwi 0, 0
beq+ .L_sbrk_ok
- b PIC_PLT(_ASM_LABEL(__cerror))
+ b _ASM_LABEL(___cerror)
/* update, __curbrk and return */
.L_sbrk_ok: