diff options
Diffstat (limited to 'src')
29 files changed, 66 insertions, 88 deletions
diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c index 31d324a8..e0224243 100644 --- a/src/env/__init_tls.c +++ b/src/env/__init_tls.c @@ -72,8 +72,7 @@ typedef Elf32_Phdr Phdr; typedef Elf64_Phdr Phdr; #endif -__attribute__((__weak__, __visibility__("hidden"))) -extern const size_t _DYNAMIC[]; +extern weak hidden const size_t _DYNAMIC[]; static void static_init_tls(size_t *aux) { diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c index 0583f686..c1b06697 100644 --- a/src/env/__libc_start_main.c +++ b/src/env/__libc_start_main.c @@ -11,8 +11,7 @@ void __init_tls(size_t *); static void dummy(void) {} weak_alias(dummy, _init); -__attribute__((__weak__, __visibility__("hidden"))) -extern void (*const __init_array_start)(void), (*const __init_array_end)(void); +extern weak hidden void (*const __init_array_start)(void), (*const __init_array_end)(void); static void dummy1(void *p) {} weak_alias(dummy1, __init_ssp); diff --git a/src/env/__stack_chk_fail.c b/src/env/__stack_chk_fail.c index 4de82fd9..e32596d1 100644 --- a/src/env/__stack_chk_fail.c +++ b/src/env/__stack_chk_fail.c @@ -17,7 +17,6 @@ void __stack_chk_fail(void) a_crash(); } -__attribute__((__visibility__("hidden"))) -void __stack_chk_fail_local(void); +hidden void __stack_chk_fail_local(void); weak_alias(__stack_chk_fail, __stack_chk_fail_local); diff --git a/src/exit/abort.c b/src/exit/abort.c index d6bd546b..7c323d26 100644 --- a/src/exit/abort.c +++ b/src/exit/abort.c @@ -6,8 +6,7 @@ #include "libc.h" #include "ksigaction.h" -__attribute__((__visibility__("hidden"))) -volatile int __abort_lock[1]; +hidden volatile int __abort_lock[1]; _Noreturn void abort(void) { diff --git a/src/exit/exit.c b/src/exit/exit.c index bf7835a1..a6869b37 100644 --- a/src/exit/exit.c +++ b/src/exit/exit.c @@ -12,8 +12,7 @@ weak_alias(dummy, __funcs_on_exit); weak_alias(dummy, __stdio_exit); weak_alias(dummy, _fini); -__attribute__((__weak__, __visibility__("hidden"))) -extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void); +extern weak hidden void (*const __fini_array_start)(void), (*const __fini_array_end)(void); static void libc_exit_fini(void) { diff --git a/src/internal/fdpic_crt.h b/src/internal/fdpic_crt.h index 7eb50c6b..3c3f077d 100644 --- a/src/internal/fdpic_crt.h +++ b/src/internal/fdpic_crt.h @@ -1,7 +1,7 @@ #include <stdint.h> +#include "libc.h" -__attribute__((__visibility__("hidden"))) -void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z) +hidden void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z) { /* If map is a null pointer, the program was loaded by a * non-FDPIC-aware ELF loader, and fixups are not needed, diff --git a/src/internal/libc.h b/src/internal/libc.h index 5e145183..7307a738 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -33,24 +33,21 @@ struct __libc { #define PAGE_SIZE libc.page_size #endif -#ifdef __PIC__ -#define ATTR_LIBC_VISIBILITY __attribute__((visibility("hidden"))) -#else -#define ATTR_LIBC_VISIBILITY -#endif +#define weak __attribute__((__weak__)) +#define hidden __attribute__((__visibility__("hidden"))) -extern struct __libc __libc ATTR_LIBC_VISIBILITY; +extern hidden struct __libc __libc; #define libc __libc -extern size_t __hwcap ATTR_LIBC_VISIBILITY; -extern size_t __sysinfo ATTR_LIBC_VISIBILITY; +extern hidden size_t __hwcap; +extern hidden size_t __sysinfo; extern char *__progname, *__progname_full; /* Designed to avoid any overhead in non-threaded processes */ -void __lock(volatile int *) ATTR_LIBC_VISIBILITY; -void __unlock(volatile int *) ATTR_LIBC_VISIBILITY; -int __lockfile(FILE *) ATTR_LIBC_VISIBILITY; -void __unlockfile(FILE *) ATTR_LIBC_VISIBILITY; +hidden void __lock(volatile int *); +hidden void __unlock(volatile int *); +hidden int __lockfile(FILE *); +hidden void __unlockfile(FILE *); #define LOCK(x) __lock(x) #define UNLOCK(x) __unlock(x) @@ -61,7 +58,7 @@ extern char **__environ; #undef weak_alias #define weak_alias(old, new) \ - extern __typeof(old) new __attribute__((weak, alias(#old))) + extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) #undef LFS64_2 #define LFS64_2(x, y) weak_alias(x, y) diff --git a/src/internal/malloc_impl.h b/src/internal/malloc_impl.h index 5d025b06..4355d84c 100644 --- a/src/internal/malloc_impl.h +++ b/src/internal/malloc_impl.h @@ -1,6 +1,8 @@ #ifndef MALLOC_IMPL_H #define MALLOC_IMPL_H +#include "libc.h" + void *__mmap(void *, size_t, int, int, int, off_t); int __munmap(void *, size_t); void *__mremap(void *, size_t, size_t, int, ...); @@ -36,10 +38,8 @@ struct bin { #define IS_MMAPPED(c) !((c)->csize & (C_INUSE)) -__attribute__((__visibility__("hidden"))) -void __bin_chunk(struct chunk *); +hidden void __bin_chunk(struct chunk *); -__attribute__((__visibility__("hidden"))) -extern int __malloc_replaced; +hidden extern int __malloc_replaced; #endif diff --git a/src/internal/sh/__shcall.c b/src/internal/sh/__shcall.c index dfe80a7f..23655904 100644 --- a/src/internal/sh/__shcall.c +++ b/src/internal/sh/__shcall.c @@ -1,5 +1,6 @@ -__attribute__((__visibility__("hidden"))) -int __shcall(void *arg, int (*func)(void *)) +#include "libc.h" + +hidden int __shcall(void *arg, int (*func)(void *)) { return func(arg); } diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 6d378a81..c12a46cd 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -2,6 +2,7 @@ #define _INTERNAL_SYSCALL_H #include <sys/syscall.h> +#include "libc.h" #include "syscall_arch.h" #ifndef SYSCALL_RLIM_INFINITY @@ -21,8 +22,7 @@ typedef long syscall_arg_t; #endif -__attribute__((visibility("hidden"))) -long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...), +hidden long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...), __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t); diff --git a/src/internal/version.c b/src/internal/version.c index dc044ec4..0d6e1f82 100644 --- a/src/internal/version.c +++ b/src/internal/version.c @@ -1,9 +1,9 @@ #include "version.h" +#include "libc.h" static const char version[] = VERSION; -__attribute__((__visibility__("hidden"))) -const char *__libc_get_version() +hidden const char *__libc_get_version() { return version; } diff --git a/src/ldso/__dlsym.c b/src/ldso/__dlsym.c index 99aafdf9..bf99dff8 100644 --- a/src/ldso/__dlsym.c +++ b/src/ldso/__dlsym.c @@ -1,8 +1,7 @@ #include <dlfcn.h> #include "libc.h" -__attribute__((__visibility__("hidden"))) -void __dl_seterr(const char *, ...); +hidden void __dl_seterr(const char *, ...); static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra) { diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c index f3160ef4..86c87ef8 100644 --- a/src/ldso/dl_iterate_phdr.c +++ b/src/ldso/dl_iterate_phdr.c @@ -4,8 +4,7 @@ #define AUX_CNT 38 -__attribute__((__weak__, __visibility__("hidden"))) -extern const size_t _DYNAMIC[]; +extern weak hidden const size_t _DYNAMIC[]; static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data) { diff --git a/src/ldso/dlclose.c b/src/ldso/dlclose.c index 0ef22319..a774209d 100644 --- a/src/ldso/dlclose.c +++ b/src/ldso/dlclose.c @@ -1,7 +1,7 @@ #include <dlfcn.h> +#include "libc.h" -__attribute__((__visibility__("hidden"))) -int __dl_invalid_handle(void *); +hidden int __dl_invalid_handle(void *); int dlclose(void *p) { diff --git a/src/ldso/dlerror.c b/src/ldso/dlerror.c index 378f0356..c8c718ab 100644 --- a/src/ldso/dlerror.c +++ b/src/ldso/dlerror.c @@ -23,8 +23,7 @@ void __dl_thread_cleanup(void) free(self->dlerror_buf); } -__attribute__((__visibility__("hidden"))) -void __dl_vseterr(const char *fmt, va_list ap) +hidden void __dl_vseterr(const char *fmt, va_list ap) { va_list ap2; va_copy(ap2, ap); @@ -43,8 +42,7 @@ void __dl_vseterr(const char *fmt, va_list ap) self->dlerror_flag = 1; } -__attribute__((__visibility__("hidden"))) -void __dl_seterr(const char *fmt, ...) +hidden void __dl_seterr(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -52,8 +50,7 @@ void __dl_seterr(const char *fmt, ...) va_end(ap); } -__attribute__((__visibility__("hidden"))) -int __dl_invalid_handle(void *); +hidden int __dl_invalid_handle(void *); static int stub_invalid_handle(void *h) { diff --git a/src/ldso/dlinfo.c b/src/ldso/dlinfo.c index a173d1ac..1e2c5500 100644 --- a/src/ldso/dlinfo.c +++ b/src/ldso/dlinfo.c @@ -1,11 +1,10 @@ #define _GNU_SOURCE #include <dlfcn.h> +#include "libc.h" -__attribute__((__visibility__("hidden"))) -int __dl_invalid_handle(void *); +hidden int __dl_invalid_handle(void *); -__attribute__((__visibility__("hidden"))) -void __dl_seterr(const char *, ...); +hidden void __dl_seterr(const char *, ...); int dlinfo(void *dso, int req, void *res) { diff --git a/src/ldso/dlopen.c b/src/ldso/dlopen.c index dcdb4398..6b1d792a 100644 --- a/src/ldso/dlopen.c +++ b/src/ldso/dlopen.c @@ -1,8 +1,7 @@ #include <dlfcn.h> #include "libc.h" -__attribute__((__visibility__("hidden"))) -void __dl_seterr(const char *, ...); +hidden void __dl_seterr(const char *, ...); static void *stub_dlopen(const char *file, int mode) { diff --git a/src/ldso/tlsdesc.c b/src/ldso/tlsdesc.c index a2985cb6..df7eb9c9 100644 --- a/src/ldso/tlsdesc.c +++ b/src/ldso/tlsdesc.c @@ -1,8 +1,7 @@ #include <stddef.h> #include "libc.h" -__attribute__((__visibility__("hidden"))) -ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); +hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); ptrdiff_t __tlsdesc_static() { diff --git a/src/multibyte/internal.h b/src/multibyte/internal.h index 421a3d4a..7d0e7828 100644 --- a/src/multibyte/internal.h +++ b/src/multibyte/internal.h @@ -1,11 +1,9 @@ #define bittab __fsmu8 #include <stdint.h> +#include "libc.h" -#ifdef __PIC__ -__attribute__((__visibility__("hidden"))) -#endif -extern const uint32_t bittab[]; +extern hidden const uint32_t bittab[]; /* Upper 6 state bits are a negative integer offset to bound-check next byte */ /* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */ diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c index ac9a3ac2..2adedaa4 100644 --- a/src/signal/sigaction.c +++ b/src/signal/sigaction.c @@ -8,7 +8,8 @@ volatile int dummy_lock[1] = { 0 }; -__attribute__((__visibility__("hidden"))) +extern hidden volatile int __abort_lock[1]; + weak_alias(dummy_lock, __abort_lock); static int unmask_done; diff --git a/src/signal/sigsetjmp_tail.c b/src/signal/sigsetjmp_tail.c index 78762aa2..252529a4 100644 --- a/src/signal/sigsetjmp_tail.c +++ b/src/signal/sigsetjmp_tail.c @@ -1,9 +1,9 @@ #include <setjmp.h> #include <signal.h> #include "syscall.h" +#include "libc.h" -__attribute__((__visibility__("hidden"))) -int __sigsetjmp_tail(sigjmp_buf jb, int ret) +hidden int __sigsetjmp_tail(sigjmp_buf jb, int ret) { void *p = jb->__ss; __syscall(SYS_rt_sigprocmask, SIG_SETMASK, ret?p:0, ret?0:p, _NSIG/8); diff --git a/src/thread/__syscall_cp.c b/src/thread/__syscall_cp.c index 09a2be84..afd82eff 100644 --- a/src/thread/__syscall_cp.c +++ b/src/thread/__syscall_cp.c @@ -1,8 +1,8 @@ #include "pthread_impl.h" #include "syscall.h" +#include "libc.h" -__attribute__((__visibility__("hidden"))) -long __syscall_cp_c(); +hidden long __syscall_cp_c(); static long sccp(syscall_arg_t nr, syscall_arg_t u, syscall_arg_t v, syscall_arg_t w, diff --git a/src/thread/__tls_get_addr.c b/src/thread/__tls_get_addr.c index 3b6c9b1b..3bc60571 100644 --- a/src/thread/__tls_get_addr.c +++ b/src/thread/__tls_get_addr.c @@ -2,8 +2,7 @@ #include "pthread_impl.h" #include "libc.h" -__attribute__((__visibility__("hidden"))) -void *__tls_get_new(tls_mod_off_t *); +hidden void *__tls_get_new(tls_mod_off_t *); void *__tls_get_addr(tls_mod_off_t *v) { diff --git a/src/thread/arm/__set_thread_area.c b/src/thread/arm/__set_thread_area.c index daf496c2..09de65aa 100644 --- a/src/thread/arm/__set_thread_area.c +++ b/src/thread/arm/__set_thread_area.c @@ -5,7 +5,7 @@ #define HWCAP_TLS (1 << 15) -extern const unsigned char __attribute__((__visibility__("hidden"))) +extern hidden const unsigned char __a_barrier_oldkuser[], __a_barrier_v6[], __a_barrier_v7[], __a_cas_v6[], __a_cas_v7[], __a_gettp_cp15[]; @@ -22,8 +22,7 @@ extern const unsigned char __attribute__((__visibility__("hidden"))) #define __a_gettp_kuser 0xffff0fe0 #define __a_gettp_cp15 (uintptr_t)__a_gettp_cp15 -extern uintptr_t __attribute__((__visibility__("hidden"))) - __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr; +extern hidden uintptr_t __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr; int __set_thread_area(void *p) { diff --git a/src/thread/pthread_attr_setinheritsched.c b/src/thread/pthread_attr_setinheritsched.c index e540e846..605af973 100644 --- a/src/thread/pthread_attr_setinheritsched.c +++ b/src/thread/pthread_attr_setinheritsched.c @@ -1,8 +1,8 @@ #include "pthread_impl.h" #include "syscall.h" +#include "libc.h" -__attribute__((__visibility__("hidden"))) -void *__start_sched(void *p) +hidden void *__start_sched(void *p) { struct start_sched_args *ssa = p; void *start_arg = ssa->start_arg; diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c index 5d458af2..43f8d405 100644 --- a/src/thread/pthread_cancel.c +++ b/src/thread/pthread_cancel.c @@ -4,8 +4,7 @@ #include "syscall.h" #include "libc.h" -__attribute__((__visibility__("hidden"))) -long __cancel(), __syscall_cp_asm(), __syscall_cp_c(); +hidden long __cancel(), __syscall_cp_asm(), __syscall_cp_c(); long __cancel() { @@ -45,8 +44,7 @@ static void _sigaddset(sigset_t *set, int sig) set->__bits[s/8/sizeof *set->__bits] |= 1UL<<(s&8*sizeof *set->__bits-1); } -__attribute__((__visibility__("hidden"))) -extern const char __cp_begin[1], __cp_end[1], __cp_cancel[1]; +extern hidden const char __cp_begin[1], __cp_end[1], __cp_cancel[1]; static void cancel_handler(int sig, siginfo_t *si, void *ctx) { diff --git a/src/thread/sh/__set_thread_area.c b/src/thread/sh/__set_thread_area.c index 9c47f78d..34264bdd 100644 --- a/src/thread/sh/__set_thread_area.c +++ b/src/thread/sh/__set_thread_area.c @@ -7,14 +7,11 @@ #define CPU_HAS_LLSC 0x0040 #define CPU_HAS_CAS_L 0x0400 -__attribute__((__visibility__("hidden"))) -extern const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[]; +extern hidden const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[]; -__attribute__((__visibility__("hidden"))) -const void *__sh_cas_ptr; +hidden const void *__sh_cas_ptr; -__attribute__((__visibility__("hidden"))) -unsigned __sh_nommu; +hidden unsigned __sh_nommu; int __set_thread_area(void *p) { diff --git a/src/thread/sh/__unmapself.c b/src/thread/sh/__unmapself.c index d4fb8be5..719392a6 100644 --- a/src/thread/sh/__unmapself.c +++ b/src/thread/sh/__unmapself.c @@ -12,7 +12,7 @@ void __unmapself_sh_nommu(void *, size_t); : : "r"(pc), "r"(sp) : "r0", "memory" ) #include "../__unmapself.c" #undef __unmapself -extern __attribute__((__visibility__("hidden"))) unsigned __sh_nommu; +extern hidden unsigned __sh_nommu; #else #define __sh_nommu 0 #endif diff --git a/src/thread/x32/syscall_cp_fixup.c b/src/thread/x32/syscall_cp_fixup.c index b1f3a382..b1a1faa6 100644 --- a/src/thread/x32/syscall_cp_fixup.c +++ b/src/thread/x32/syscall_cp_fixup.c @@ -1,8 +1,9 @@ #include <sys/syscall.h> +#include "libc.h" -__attribute__((__visibility__("hidden"))) -long __syscall_cp_internal(volatile void*, long long, long long, long long, long long, - long long, long long, long long); +hidden long __syscall_cp_internal(volatile void*, long long, long long, + long long, long long, long long, + long long, long long); struct __timespec { long long tv_sec; long tv_nsec; }; struct __timespec_kernel { long long tv_sec; long long tv_nsec; }; @@ -12,9 +13,9 @@ struct __timespec_kernel { long long tv_sec; long long tv_nsec; }; ts->tv_nsec = __tsc(X)->tv_nsec; \ (X) = (unsigned long)ts; } } while(0) -__attribute__((__visibility__("hidden"))) -long __syscall_cp_asm (volatile void * foo, long long n, long long a1, long long a2, long long a3, - long long a4, long long a5, long long a6) +hidden long __syscall_cp_asm (volatile void * foo, long long n, long long a1, + long long a2, long long a3, long long a4, + long long a5, long long a6) { struct __timespec_kernel ts[1]; switch (n) { |