From d3ba0fe2f23c19864b0b45b622f0a013af0390d9 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 18 Mar 2017 12:50:15 +0000 Subject: Make brk(2) actually work and sync the brk()/sbrk() implementation with arm, brininging over all the symbol visibility improvements that guenther@ made. ok drahn@ --- lib/libc/arch/aarch64/sys/brk.S | 32 +++++++++++++++----------------- lib/libc/arch/aarch64/sys/sbrk.S | 32 ++++++++++++++------------------ 2 files changed, 29 insertions(+), 35 deletions(-) (limited to 'lib/libc/arch') diff --git a/lib/libc/arch/aarch64/sys/brk.S b/lib/libc/arch/aarch64/sys/brk.S index 0a259b1edcc..22801bd770c 100644 --- a/lib/libc/arch/aarch64/sys/brk.S +++ b/lib/libc/arch/aarch64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */ +/* $OpenBSD: brk.S,v 1.2 2017/03/18 12:50:13 kettenis Exp $ */ /* $NetBSD: brk.S,v 1.7 2003/12/26 11:23:44 martin Exp $ */ /*- @@ -35,27 +35,23 @@ #include "SYS.h" .globl _C_LABEL(end) - .globl CURBRK - -#ifdef WEAK_ALIAS -WEAK_ALIAS(brk, _brk) -#endif + .globl __curbrk .data .align 0 - .globl _C_LABEL(__minbrk) - .type _C_LABEL(__minbrk),#object -_C_LABEL(__minbrk): - .quad _C_LABEL(end) + .type __minbrk,#object +__minbrk: + .quad _C_LABEL(_end) + END(__minbrk) /* * Change the data segment size */ -SYSENTRY(_brk) +ENTRY(brk) #ifdef __PIC__ /* Setup the GOT */ - adrp x3, :got:minbrk - ldr x1, [x3, #:got_lo12:minbrk] + adrp x3, :got:__minbrk + ldr x1, [x3, #:got_lo12:__minbrk] #else ldr x1, .Lminbrk #endif @@ -75,8 +71,8 @@ SYSENTRY(_brk) bcs CERROR #ifdef __PIC__ - adrp x3, :got:minbrk - ldr x1, [x3, #:got_lo12:minbrk] + adrp x3, :got:__curbrk + ldr x1, [x3, #:got_lo12:__curbrk] #else ldr x1, .Lcurbrk #endif @@ -90,7 +86,9 @@ SYSENTRY(_brk) .align 3 #if !defined(__PIC__) .Lminbrk: - .quad _C_LABEL(__minbrk) + .quad __minbrk .Lcurbrk: - .quad CURBRK + .quad __curbrk #endif +END(brk) + .weak brk diff --git a/lib/libc/arch/aarch64/sys/sbrk.S b/lib/libc/arch/aarch64/sys/sbrk.S index 8732a96b860..2da37af9103 100644 --- a/lib/libc/arch/aarch64/sys/sbrk.S +++ b/lib/libc/arch/aarch64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */ +/* $OpenBSD: sbrk.S,v 1.2 2017/03/18 12:50:14 kettenis Exp $ */ /* $NetBSD: sbrk.S,v 1.7 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -34,31 +34,25 @@ #include "SYS.h" - .globl _C_LABEL(end) - -#ifdef WEAK_ALIAS -WEAK_ALIAS(sbrk, _sbrk) -#endif + .globl _C_LABEL(_end) .data .align 0 - .globl CURBRK - .type CURBRK,#object - .globl minbrk - .type minbrk,#object -CURBRK: - .quad _C_LABEL(end) -_ASM_LABEL(minbrk): - .quad _C_LABEL(end) + .globl __curbrk + .type __curbrk,#object + .hidden __curbrk +__curbrk: + .quad _C_LABEL(_end) + END(__curbrk) /* * Change the data segment size */ -SYSENTRY(_sbrk) +ENTRY(sbrk) #ifdef __PIC__ /* Setup the GOT */ - adrp x3, :got:CURBRK - ldr x2, [x3, #:got_lo12:CURBRK] + adrp x3, :got:__curbrk + ldr x2, [x3, #:got_lo12:__curbrk] #else ldr x2, .Lcurbrk #endif @@ -82,5 +76,7 @@ SYSENTRY(_sbrk) .align 0 #if !defined(__PIC__) .Lcurbrk: - .word CURBRK + .word __curbrk #endif +END(sbrk) + .weak sbrk -- cgit v1.2.3