summaryrefslogtreecommitdiff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-09-05 12:43:34 -0400
committerRich Felker <dalias@aerifal.cx>2018-09-05 14:05:14 -0400
commit9b95fd0944e4206949e90633c3fed088202810ec (patch)
tree4af9c66139abfef78854aca3200f836153727c23 /src/thread
parent2de29bc994029b903a366b8a4a9f8c3c3ee2be90 (diff)
downloadmusl-9b95fd0944e4206949e90633c3fed088202810ec.tar.gz
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.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/__syscall_cp.c4
-rw-r--r--src/thread/__tls_get_addr.c3
-rw-r--r--src/thread/arm/__set_thread_area.c5
-rw-r--r--src/thread/pthread_attr_setinheritsched.c4
-rw-r--r--src/thread/pthread_cancel.c6
-rw-r--r--src/thread/sh/__set_thread_area.c9
-rw-r--r--src/thread/sh/__unmapself.c2
-rw-r--r--src/thread/x32/syscall_cp_fixup.c13
8 files changed, 20 insertions, 26 deletions
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) {