From 3c2175b12b8a6cd2362a8c5bd8e2e31d54a8b4da Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 14 Dec 2005 13:48:23 +0000 Subject: Do hidden brk, hide _brk as well for some archs, convert users of brk --- libc/sysdeps/linux/alpha/brk.S | 1 + libc/sysdeps/linux/arm/brk.c | 3 ++- libc/sysdeps/linux/bfin/brk.c | 3 ++- libc/sysdeps/linux/common/bits/uClibc_stdio.h | 4 ++-- libc/sysdeps/linux/common/sbrk.c | 6 +++--- libc/sysdeps/linux/cris/brk.c | 3 ++- libc/sysdeps/linux/frv/__init_brk.c | 2 +- libc/sysdeps/linux/frv/brk.c | 5 +++-- libc/sysdeps/linux/frv/sbrk.c | 2 +- libc/sysdeps/linux/h8300/brk.c | 3 ++- libc/sysdeps/linux/hppa/brk.c | 5 +++-- libc/sysdeps/linux/i386/brk.c | 4 ++-- libc/sysdeps/linux/m68k/brk.c | 3 ++- libc/sysdeps/linux/mips/brk.c | 3 ++- libc/sysdeps/linux/nios/brk.c | 4 ++-- libc/sysdeps/linux/nios2/brk.c | 3 ++- libc/sysdeps/linux/powerpc/brk.S | 1 + libc/sysdeps/linux/sh/__init_brk.c | 2 +- libc/sysdeps/linux/sh/brk.c | 5 +++-- libc/sysdeps/linux/sh/sbrk.c | 2 +- libc/sysdeps/linux/sh64/__init_brk.c | 2 +- libc/sysdeps/linux/sh64/brk.c | 5 +++-- libc/sysdeps/linux/sh64/sbrk.c | 2 +- libc/sysdeps/linux/sparc/brk.c | 3 ++- libc/sysdeps/linux/x86_64/brk.c | 3 ++- 25 files changed, 47 insertions(+), 32 deletions(-) diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index 4e15518d2..a3f2edfe7 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -39,6 +39,7 @@ __curbrk: .skip 8 .text .globl __brk; +.hidden __brk; .align 3; .ent __brk , 0; diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index 82b9835ae..e711db3b1 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr); @@ -37,3 +37,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 178124ed3..1cb30216d 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -6,7 +6,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -28,3 +28,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h index 6831ca43a..886e790f0 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h +++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h @@ -363,8 +363,8 @@ struct __STDIO_FILE_STRUCT { **********************************************************************/ #if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) -extern void _stdio_init(void); -extern void _stdio_term(void); +extern void _stdio_init(void) attribute_hidden; +extern void _stdio_term(void) attribute_hidden; #ifdef __STDIO_HAS_OPENLIST diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index 945adbd6f..d8507335b 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -21,7 +21,7 @@ /* Defined in brk.c. */ extern void *__curbrk; -extern int brk (void *addr); +extern int __brk (void *addr) attribute_hidden; /* Extend the process's data space by INCREMENT. @@ -32,14 +32,14 @@ void attribute_hidden * __sbrk (intptr_t increment) void *oldbrk; if (__curbrk == NULL) - if (brk (0) < 0) /* Initialize the break. */ + if (__brk (0) < 0) /* Initialize the break. */ return (void *) -1; if (increment == 0) return __curbrk; oldbrk = __curbrk; - if (brk (oldbrk + increment) < 0) + if (__brk (oldbrk + increment) < 0) return (void *) -1; return oldbrk; diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index 0bc08d5e6..10965d3b9 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { /* @@ -29,3 +29,4 @@ int brk(void * end_data_seg) return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/frv/__init_brk.c b/libc/sysdeps/linux/frv/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/frv/__init_brk.c +++ b/libc/sysdeps/linux/frv/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index 9cc8c4abd..e9faf7db0 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; void attribute_hidden * __sbrk(intptr_t increment) diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index bd0ecaa5c..d69f9a2d3 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -9,7 +9,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -31,3 +31,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index 68bc3ffc8..f50360aa5 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -23,8 +23,8 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int -brk (void *addr) +int attribute_hidden +__brk (void *addr) { void *newbrk; @@ -38,3 +38,4 @@ brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 09c6be7e3..5790e2fca 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -25,8 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; - -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *__unbounded newbrk, *__unbounded scratch; @@ -47,3 +46,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 689bc5bf7..4c33549cc 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -7,7 +7,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -28,3 +28,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/mips/brk.c b/libc/sysdeps/linux/mips/brk.c index c33111ed7..c513cd399 100644 --- a/libc/sysdeps/linux/mips/brk.c +++ b/libc/sysdeps/linux/mips/brk.c @@ -23,7 +23,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -47,3 +47,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 797a66d0a..2e785b734 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -25,8 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; - -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; register int g1 asm("%g1") = __NR_brk; @@ -43,3 +42,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index 1e7eb0382..e5a4c5d07 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; register int r2 asm("r2") = TRAP_ID_SYSCALL; @@ -44,3 +44,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index c0b436d96..b718c0de4 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -26,6 +26,7 @@ .comm __curbrk,4,4 .text .globl __brk + .hidden __brk .type __brk,@function .align 2 diff --git a/libc/sysdeps/linux/sh/__init_brk.c b/libc/sysdeps/linux/sh/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/sh/__init_brk.c +++ b/libc/sysdeps/linux/sh/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index 9cc8c4abd..e9faf7db0 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; void attribute_hidden * __sbrk(intptr_t increment) diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c index c9a2a3ec5..92e07c49d 100644 --- a/libc/sysdeps/linux/sh64/__init_brk.c +++ b/libc/sysdeps/linux/sh64/__init_brk.c @@ -7,7 +7,7 @@ void * __curbrk = 0; #define __NR__brk __NR_brk -_syscall1(void *, _brk, void *, ptr); +attribute_hidden _syscall1(void *, _brk, void *, ptr); int __init_brk (void) diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index 2406904a3..d6063fc27 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -7,9 +7,9 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; -int brk(void * end_data_seg) +int attribute_hidden __brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,3 +20,4 @@ int brk(void * end_data_seg) } return -1; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c index 9cc8c4abd..e9faf7db0 100644 --- a/libc/sysdeps/linux/sh64/sbrk.c +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -extern void *_brk(void *ptr); +extern void *_brk(void *ptr) attribute_hidden; void attribute_hidden * __sbrk(intptr_t increment) diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index 82d6147ca..9e178e34f 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *newbrk; @@ -47,3 +47,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) diff --git a/libc/sysdeps/linux/x86_64/brk.c b/libc/sysdeps/linux/x86_64/brk.c index 303b5c0de..a00e2361e 100644 --- a/libc/sysdeps/linux/x86_64/brk.c +++ b/libc/sysdeps/linux/x86_64/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int brk (void *addr) +int attribute_hidden __brk (void *addr) { void *__unbounded newbrk; @@ -42,3 +42,4 @@ int brk (void *addr) return 0; } +strong_alias(__brk,brk) -- cgit v1.2.3