From 9b95fd0944e4206949e90633c3fed088202810ec Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 5 Sep 2018 12:43:34 -0400 Subject: 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. --- arch/arm/atomic_arch.h | 5 +++-- arch/arm/pthread_arch.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'arch/arm') 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)); -- cgit v1.2.1