From: Rich Felker Date: Wed, 5 Sep 2018 16:43:34 +0000 (-0400) Subject: define and use internal macros for hidden visibility, weak refs X-Git-Tag: v1.1.21~163 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9b95fd0944e4206949e90633c3fed088202810ec;p=oweals%2Fmusl.git define and use internal macros for hidden visibility, weak refs this cleans up what had become widespread direct inline use of "GNU C" style attributes directly in the source, and lowers the barrier to increased use of hidden visibility, which will be useful to recovering some of the efficiency lost when the protected visibility hack was dropped in commit dc2f368e565c37728b0d620380b849c3a1ddd78f, especially on archs where the PLT ABI is costly. --- diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h index 62458b45..e427836a 100644 --- a/arch/arm/atomic_arch.h +++ b/arch/arm/atomic_arch.h @@ -1,11 +1,12 @@ +#include "libc.h" + #if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4 #define BLX "mov lr,pc\n\tbx" #else #define BLX "blx" #endif -extern uintptr_t __attribute__((__visibility__("hidden"))) - __a_cas_ptr, __a_barrier_ptr; +extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr; #if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \ || __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h index 8f2ae8f8..5c6aff28 100644 --- a/arch/arm/pthread_arch.h +++ b/arch/arm/pthread_arch.h @@ -18,7 +18,7 @@ static inline pthread_t __pthread_self() static inline pthread_t __pthread_self() { - extern uintptr_t __attribute__((__visibility__("hidden"))) __a_gettp_ptr; + extern hidden uintptr_t __a_gettp_ptr; register uintptr_t p __asm__("r0"); __asm__ __volatile__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" ); return (void *)(p-sizeof(struct pthread)); diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h index 666f413f..01de67b8 100644 --- a/arch/mips/syscall_arch.h +++ b/arch/mips/syscall_arch.h @@ -3,8 +3,7 @@ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) -__attribute__((visibility("hidden"))) -long (__syscall)(long, ...); +hidden long (__syscall)(long, ...); #define SYSCALL_RLIM_INFINITY (-1UL/2) diff --git a/arch/mipsn32/syscall_arch.h b/arch/mipsn32/syscall_arch.h index 93a026f6..f6a1fbae 100644 --- a/arch/mipsn32/syscall_arch.h +++ b/arch/mipsn32/syscall_arch.h @@ -1,8 +1,7 @@ #define __SYSCALL_LL_E(x) (x) #define __SYSCALL_LL_O(x) (x) -__attribute__((visibility("hidden"))) -long (__syscall)(long, ...); +hidden long (__syscall)(long, ...); #define SYSCALL_RLIM_INFINITY (-1UL/2) diff --git a/arch/sh/atomic_arch.h b/arch/sh/atomic_arch.h index d48a7651..0a4d0c11 100644 --- a/arch/sh/atomic_arch.h +++ b/arch/sh/atomic_arch.h @@ -1,3 +1,5 @@ +#include "libc.h" + #if defined(__SH4A__) #define a_ll a_ll @@ -30,7 +32,7 @@ static inline void a_barrier() #else #define a_cas a_cas -__attribute__((__visibility__("hidden"))) extern const void *__sh_cas_ptr; +extern hidden const void *__sh_cas_ptr; static inline int a_cas(volatile int *p, int t, int s) { register int r1 __asm__("r1"); diff --git a/crt/crt1.c b/crt/crt1.c index af02af94..7b12665f 100644 --- a/crt/crt1.c +++ b/crt/crt1.c @@ -1,12 +1,13 @@ #include +#include "libc.h" #define START "_start" #include "crt_arch.h" int main(); -void _init() __attribute__((weak)); -void _fini() __attribute__((weak)); +weak void _init(); +weak void _fini(); _Noreturn int __libc_start_main(int (*)(), int, char **, void (*)(), void(*)(), void(*)()); diff --git a/crt/rcrt1.c b/crt/rcrt1.c index be017153..7bb3322f 100644 --- a/crt/rcrt1.c +++ b/crt/rcrt1.c @@ -3,13 +3,12 @@ #include "../ldso/dlstart.c" int main(); -void _init() __attribute__((weak)); -void _fini() __attribute__((weak)); +weak void _init(); +weak void _fini(); _Noreturn int __libc_start_main(int (*)(), int, char **, void (*)(), void(*)(), void(*)()); -__attribute__((__visibility__("hidden"))) -_Noreturn void __dls2(unsigned char *base, size_t *sp) +hidden _Noreturn void __dls2(unsigned char *base, size_t *sp) { __libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0); } diff --git a/ldso/dlstart.c b/ldso/dlstart.c index 4dbe1784..20d50f2c 100644 --- a/ldso/dlstart.c +++ b/ldso/dlstart.c @@ -1,5 +1,6 @@ #include #include "dynlink.h" +#include "libc.h" #ifndef START #define START "_dlstart" @@ -11,14 +12,13 @@ #ifndef GETFUNCSYM #define GETFUNCSYM(fp, sym, got) do { \ - __attribute__((__visibility__("hidden"))) void sym(); \ + hidden void sym(); \ static void (*static_func_ptr)() = sym; \ __asm__ __volatile__ ( "" : "+m"(static_func_ptr) : : "memory"); \ *(fp) = static_func_ptr; } while(0) #endif -__attribute__((__visibility__("hidden"))) -void _dlstart_c(size_t *sp, size_t *dynv) +hidden void _dlstart_c(size_t *sp, size_t *dynv) { size_t i, aux[AUX_CNT], dyn[DYN_CNT]; size_t *rel, rel_size, base; diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 87281ddb..b46cbafb 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -99,8 +99,7 @@ int __init_tp(void *); void __init_libc(char **, char *); void *__copy_tls(unsigned char *); -__attribute__((__visibility__("hidden"))) -const char *__libc_get_version(void); +hidden const char *__libc_get_version(void); static struct builtin_tls { char c; @@ -133,14 +132,11 @@ static struct dso *const nodeps_dummy; struct debug *_dl_debug_addr = &debug; -__attribute__((__visibility__("hidden"))) -extern int __malloc_replaced; +extern hidden int __malloc_replaced; -__attribute__((__visibility__("hidden"))) -void (*const __init_array_start)(void)=0, (*const __fini_array_start)(void)=0; +hidden void (*const __init_array_start)(void)=0, (*const __fini_array_start)(void)=0; -__attribute__((__visibility__("hidden"))) -extern void (*const __init_array_end)(void), (*const __fini_array_end)(void); +extern hidden void (*const __init_array_end)(void), (*const __fini_array_end)(void); weak_alias(__init_array_start, __init_array_end); weak_alias(__fini_array_start, __fini_array_end); @@ -306,8 +302,7 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def) return def; } -__attribute__((__visibility__("hidden"))) -ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); +hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic(); static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride) { @@ -1332,8 +1327,7 @@ void __init_tls(size_t *auxv) { } -__attribute__((__visibility__("hidden"))) -void *__tls_get_new(tls_mod_off_t *v) +hidden void *__tls_get_new(tls_mod_off_t *v) { pthread_t self = __pthread_self(); @@ -1401,8 +1395,7 @@ static void update_tls_size() * linker itself, but some of the relocations performed may need to be * replaced later due to copy relocations in the main program. */ -__attribute__((__visibility__("hidden"))) -void __dls2(unsigned char *base, size_t *sp) +hidden void __dls2(unsigned char *base, size_t *sp) { if (DL_FDPIC) { void *p1 = (void *)sp[-2]; @@ -1860,8 +1853,7 @@ end: return p; } -__attribute__((__visibility__("hidden"))) -int __dl_invalid_handle(void *h) +hidden int __dl_invalid_handle(void *h) { struct dso *p; for (p=head; p; p=p->next) if (h==p) return 0; @@ -2027,8 +2019,7 @@ int dladdr(const void *addr_arg, Dl_info *info) return 1; } -__attribute__((__visibility__("hidden"))) -void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra) +hidden void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra) { void *res; pthread_rwlock_rdlock(&lock); @@ -2063,8 +2054,7 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void return ret; } -__attribute__((__visibility__("hidden"))) -void __dl_vseterr(const char *, va_list); +hidden void __dl_vseterr(const char *, va_list); static void error(const char *fmt, ...) { 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 +#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 +#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 #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 +#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 +#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 #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 #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 +#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 #include #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 +#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) {