diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-30 20:06:01 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-30 20:06:01 +0000 |
commit | 9efd18d33815d59900becfac7820902e15b6126e (patch) | |
tree | e4fd0e33c81e1eee08ab42a9b452e7a328923ab4 | |
parent | 8ed0fdbe78c0c828efbc183ea8290081fd7b5d03 (diff) |
s/___brk_addr/__curbrk/g
Some utilities, such as valgrind, have a legitimate reason to know the address
of the current brk. Since we know such utils will peek under our skirt, we
might as well give them what they expect and not use a gratuitously different
symbol name.
-Erik
24 files changed, 83 insertions, 84 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index a37b250ce..eaa8a8ff0 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -612,7 +612,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt up each symbol individually. */ - _dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("___brk_addr", NULL, 0); + _dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("__curbrk", NULL, 0); if (_dl_brkp) { *_dl_brkp = brk_addr; diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index 19bd835f4..8c70a0ce5 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -29,12 +29,12 @@ #ifdef __PIC__ .section .bss .align 3 - .globl ___brk_addr -___brk_addr: .skip 8 - .type ___brk_addr,@object - .size ___brk_addr,8 + .globl __curbrk +__curbrk: .skip 8 + .type __curbrk,@object + .size __curbrk,8 #else -.comm ___brk_addr, 8 +.comm __curbrk, 8 #endif .text @@ -71,9 +71,9 @@ __brk: xor $16, $0, $1 bne $1, $err0 - /* Update ___brk_addr and return cleanly. */ + /* Update __curbrk and return cleanly. */ mov $31, $0 -$ok: stq $16, ___brk_addr +$ok: stq $16, __curbrk addq $30, 8, $30 ret diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index 0262aa110..fa0326a0e 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -22,7 +22,7 @@ #include <sys/syscall.h> /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) { @@ -31,11 +31,11 @@ int brk (void *addr) asm ("mov a1, %1\n" /* save the argment in r0 */ "swi %2\n" /* do the system call */ "mov %0, a1;" /* keep the return value */ - : "=r"(newbrk) + : "=r"(newbrk) : "r"(addr), "i" (__NR_brk) : "a1"); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index d8227ebe4..028370e99 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -20,7 +20,7 @@ #include <errno.h> /* Defined in brk.c. */ -extern void *___brk_addr; +extern void *__curbrk; extern int brk (void *addr); @@ -31,14 +31,14 @@ void * sbrk (intptr_t increment) { void *oldbrk; - if (___brk_addr == NULL) + if (__curbrk == NULL) if (brk (0) < 0) /* Initialize the break. */ return (void *) -1; if (increment == 0) - return ___brk_addr; + return __curbrk; - oldbrk = ___brk_addr; + oldbrk = __curbrk; if (brk (oldbrk + increment) < 0) return (void *) -1; diff --git a/libc/sysdeps/linux/cris/__init_brk.c b/libc/sysdeps/linux/cris/__init_brk.c index 15decd12b..211ae9136 100644 --- a/libc/sysdeps/linux/cris/__init_brk.c +++ b/libc/sysdeps/linux/cris/__init_brk.c @@ -5,25 +5,24 @@ #include <errno.h> #include "sysdep.h" -void * ___brk_addr = 0; +void * __curbrk = 0; int __init_brk (void) { - if (___brk_addr == 0) { - /* - * Notice that we don't need to save/restore the GOT + if (__curbrk == 0) { + /* Notice that we don't need to save/restore the GOT * register since that is not call clobbered by the syscall. */ asm ("clear.d $r10\n\t" "movu.w " STR(__NR_brk) ",$r9\n\t" "break 13\n\t" "move.d $r10, %0" - : "=r" (___brk_addr) + : "=r" (__curbrk) : : "r9", "r10"); - - if (___brk_addr == 0) { + + if (__curbrk == 0) { __set_errno(ENOMEM); return -1; } diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index d94f85726..0bc08d5e6 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -3,14 +3,14 @@ #include <errno.h> #include "sysdep.h" -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); int brk(void * end_data_seg) { if (__init_brk () == 0) { - /* + /* * Notice that we don't need to save/restore the GOT * register since that is not call clobbered by the syscall. */ @@ -18,14 +18,14 @@ int brk(void * end_data_seg) "movu.w " STR(__NR_brk) ",$r9\n\t" "break 13\n\t" "move.d $r10, %0" - : "=r" (___brk_addr) + : "=r" (__curbrk) : "g" (end_data_seg) : "r9", "r10"); - - if (___brk_addr == end_data_seg) + + if (__curbrk == end_data_seg) return 0; __set_errno(ENOMEM); } return -1; - + } diff --git a/libc/sysdeps/linux/cris/sbrk.c b/libc/sysdeps/linux/cris/sbrk.c index cec93420e..1ed1d9df9 100644 --- a/libc/sysdeps/linux/cris/sbrk.c +++ b/libc/sysdeps/linux/cris/sbrk.c @@ -5,7 +5,7 @@ #include <errno.h> #include "sysdep.h" -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); @@ -13,9 +13,9 @@ void * sbrk(intptr_t increment) { if (__init_brk () == 0) { - void * tmp = ___brk_addr + increment; + void * tmp = __curbrk + increment; - /* + /* * Notice that we don't need to save/restore the GOT * register since that is not call clobbered by the syscall. */ @@ -23,11 +23,11 @@ sbrk(intptr_t increment) "movu.w " STR(__NR_brk) ",$r9\n\t" "break 13\n\t" "move.d $r10, %0" - : "=r" (___brk_addr) + : "=r" (__curbrk) : "g" (tmp) : "r9", "r10"); - if (___brk_addr == tmp) + if (__curbrk == tmp) return tmp - increment; __set_errno(ENOMEM); return ((void *) -1); diff --git a/libc/sysdeps/linux/frv/__init_brk.c b/libc/sysdeps/linux/frv/__init_brk.c index 7f9cd3c31..c9a2a3ec5 100644 --- a/libc/sysdeps/linux/frv/__init_brk.c +++ b/libc/sysdeps/linux/frv/__init_brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -void * ___brk_addr = 0; +void * __curbrk = 0; #define __NR__brk __NR_brk _syscall1(void *, _brk, void *, ptr); @@ -12,10 +12,10 @@ _syscall1(void *, _brk, void *, ptr); int __init_brk (void) { - if (___brk_addr == 0) + if (__curbrk == 0) { - ___brk_addr = _brk(0); - if (___brk_addr == 0) + __curbrk = _brk(0); + if (__curbrk == 0) { __set_errno(ENOMEM); return -1; diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index 4f97fb084..2406904a3 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -13,8 +13,8 @@ int brk(void * end_data_seg) { if (__init_brk () == 0) { - ___brk_addr = _brk(end_data_seg); - if (___brk_addr == end_data_seg) + __curbrk = _brk(end_data_seg); + if (__curbrk == end_data_seg) return 0; __set_errno(ENOMEM); } diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index c39d60063..1c9e5b172 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -14,9 +14,9 @@ sbrk(intptr_t increment) { if (__init_brk () == 0) { - char * tmp = (char*)___brk_addr+increment; - ___brk_addr = _brk(tmp); - if (___brk_addr == tmp) + char * tmp = (char*)__curbrk+increment; + __curbrk = _brk(tmp); + if (__curbrk == tmp) return tmp-increment; __set_errno(ENOMEM); return ((void *) -1); diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index 71de9501f..bd0ecaa5c 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -6,7 +6,7 @@ /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) @@ -21,7 +21,7 @@ int brk (void *addr) : "0" (__NR_brk), "g" (addr) : "er0","er1"); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 7575ebcf0..09c6be7e3 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -23,7 +23,7 @@ /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) @@ -37,7 +37,7 @@ int brk (void *addr) : "=a" (newbrk), "=r" (scratch) : "0" (__NR_brk), "g" (__ptrvalue (addr))); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 1fe1090d3..689bc5bf7 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -5,7 +5,7 @@ #include <errno.h> /* This must be initialized data because commons can't have aliases. */ -void * ___brk_addr = 0; +void * __curbrk = 0; int brk (void *addr) { @@ -18,7 +18,7 @@ int brk (void *addr) :"=g" (newbrk) :"i" (__NR_brk),"g" (addr) : "%d0", "%d1"); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { diff --git a/libc/sysdeps/linux/mips/brk.c b/libc/sysdeps/linux/mips/brk.c index 82e44e461..c33111ed7 100644 --- a/libc/sysdeps/linux/mips/brk.c +++ b/libc/sysdeps/linux/mips/brk.c @@ -21,7 +21,7 @@ #include <unistd.h> #include <sys/syscall.h> -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) { @@ -37,7 +37,7 @@ int brk (void *addr) : "$4", "$7"); newbrk = (void *) res; } - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 6cacbfd5c..797a66d0a 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -23,7 +23,7 @@ /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) @@ -34,7 +34,7 @@ int brk (void *addr) asm volatile ("trap 63\n\t" : "=r"(newbrk) : "0"(o0), "r"(g1)); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { __set_errno (ENOMEM); diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index 3b81e7018..1e7eb0382 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -23,7 +23,7 @@ /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) @@ -35,7 +35,7 @@ int brk (void *addr) asm volatile ("trap\n\t" : "=r"(newbrk) : "0"(r2), "r"(r3), "r"(r4)); - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { __set_errno (ENOMEM); diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index f7b7e3c84..b914ce814 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -23,7 +23,7 @@ #include <sys/syscall.h> #ifdef __NR_brk - .comm ___brk_addr,4,4 + .comm __curbrk,4,4 .section ".text" .globl __brk; .type __brk, @function; @@ -39,12 +39,12 @@ __brk: mflr r4 bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 - lwz r5,___brk_addr@got(r5) + lwz r5,__curbrk@got(r5) mtlr r4 stw r3,0(r5) #else - lis r4,___brk_addr@ha - stw r3,___brk_addr@l(r4) + lis r4,__curbrk@ha + stw r3,__curbrk@l(r4) #endif cmplw r6,r3 addi r1,r1,16 diff --git a/libc/sysdeps/linux/sh/__init_brk.c b/libc/sysdeps/linux/sh/__init_brk.c index 7f9cd3c31..c9a2a3ec5 100644 --- a/libc/sysdeps/linux/sh/__init_brk.c +++ b/libc/sysdeps/linux/sh/__init_brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -void * ___brk_addr = 0; +void * __curbrk = 0; #define __NR__brk __NR_brk _syscall1(void *, _brk, void *, ptr); @@ -12,10 +12,10 @@ _syscall1(void *, _brk, void *, ptr); int __init_brk (void) { - if (___brk_addr == 0) + if (__curbrk == 0) { - ___brk_addr = _brk(0); - if (___brk_addr == 0) + __curbrk = _brk(0); + if (__curbrk == 0) { __set_errno(ENOMEM); return -1; diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index 4f97fb084..2406904a3 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -13,8 +13,8 @@ int brk(void * end_data_seg) { if (__init_brk () == 0) { - ___brk_addr = _brk(end_data_seg); - if (___brk_addr == end_data_seg) + __curbrk = _brk(end_data_seg); + if (__curbrk == end_data_seg) return 0; __set_errno(ENOMEM); } diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index c39d60063..1c9e5b172 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -14,9 +14,9 @@ sbrk(intptr_t increment) { if (__init_brk () == 0) { - char * tmp = (char*)___brk_addr+increment; - ___brk_addr = _brk(tmp); - if (___brk_addr == tmp) + char * tmp = (char*)__curbrk+increment; + __curbrk = _brk(tmp); + if (__curbrk == tmp) return tmp-increment; __set_errno(ENOMEM); return ((void *) -1); diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c index 7f9cd3c31..c9a2a3ec5 100644 --- a/libc/sysdeps/linux/sh64/__init_brk.c +++ b/libc/sysdeps/linux/sh64/__init_brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -void * ___brk_addr = 0; +void * __curbrk = 0; #define __NR__brk __NR_brk _syscall1(void *, _brk, void *, ptr); @@ -12,10 +12,10 @@ _syscall1(void *, _brk, void *, ptr); int __init_brk (void) { - if (___brk_addr == 0) + if (__curbrk == 0) { - ___brk_addr = _brk(0); - if (___brk_addr == 0) + __curbrk = _brk(0); + if (__curbrk == 0) { __set_errno(ENOMEM); return -1; diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index 4f97fb084..2406904a3 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -13,8 +13,8 @@ int brk(void * end_data_seg) { if (__init_brk () == 0) { - ___brk_addr = _brk(end_data_seg); - if (___brk_addr == end_data_seg) + __curbrk = _brk(end_data_seg); + if (__curbrk == end_data_seg) return 0; __set_errno(ENOMEM); } diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c index c39d60063..1c9e5b172 100644 --- a/libc/sysdeps/linux/sh64/sbrk.c +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/syscall.h> -extern void * ___brk_addr; +extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr); @@ -14,9 +14,9 @@ sbrk(intptr_t increment) { if (__init_brk () == 0) { - char * tmp = (char*)___brk_addr+increment; - ___brk_addr = _brk(tmp); - if (___brk_addr == tmp) + char * tmp = (char*)__curbrk+increment; + __curbrk = _brk(tmp); + if (__curbrk == tmp) return tmp-increment; __set_errno(ENOMEM); return ((void *) -1); diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index 16a5e3942..82d6147ca 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -23,7 +23,7 @@ /* This must be initialized data because commons can't have aliases. */ -void *___brk_addr = 0; +void *__curbrk = 0; int brk (void *addr) @@ -37,7 +37,7 @@ int brk (void *addr) newbrk = o0; } - ___brk_addr = newbrk; + __curbrk = newbrk; if (newbrk < addr) { |