aboutsummaryrefslogtreecommitdiffstats
path: root/core/uclibc/pthread-new-aliasing-fix.diff
blob: 2b2b37723ac096c2fdeaa0010c475b736cd6f50c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c
index 3435680..1412b57 100644
--- a/libpthread/linuxthreads/cancel.c
+++ b/libpthread/linuxthreads/cancel.c
@@ -152,8 +152,8 @@ void pthread_testcancel(void)
     __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
 }
 
-void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
-			   void (*routine)(void *), void * arg)
+void __pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
+			    void (*routine)(void *), void * arg)
 {
   pthread_descr self = thread_self();
   buffer->__routine = routine;
@@ -163,17 +163,19 @@ void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
     buffer->__prev = NULL;
   THREAD_SETMEM(self, p_cleanup, buffer);
 }
+strong_alias(__pthread_cleanup_push, _pthread_cleanup_push);
 
-void _pthread_cleanup_pop(struct _pthread_cleanup_buffer * buffer,
-			  int execute)
+void __pthread_cleanup_pop(struct _pthread_cleanup_buffer * buffer,
+			   int execute)
 {
   pthread_descr self = thread_self();
   if (execute) buffer->__routine(buffer->__arg);
   THREAD_SETMEM(self, p_cleanup, buffer->__prev);
 }
+strong_alias(__pthread_cleanup_pop, _pthread_cleanup_pop);
 
-void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
-				 void (*routine)(void *), void * arg)
+void __pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
+				  void (*routine)(void *), void * arg)
 {
   pthread_descr self = thread_self();
   buffer->__routine = routine;
@@ -185,9 +187,10 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
   THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
   THREAD_SETMEM(self, p_cleanup, buffer);
 }
+strong_alias(__pthread_cleanup_push_defer, _pthread_cleanup_push_defer);
 
-void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
-				  int execute)
+void __pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
+				   int execute)
 {
   pthread_descr self = thread_self();
   if (execute) buffer->__routine(buffer->__arg);
@@ -198,6 +201,7 @@ void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
       THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
     __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
 }
+strong_alias(__pthread_cleanup_pop_restore, _pthread_cleanup_pop_restore);
 
 extern void __rpc_thread_destroy(void);
 void __pthread_perform_cleanup(char *currentframe)
diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c
index f9f8ea1..385e79f 100644
--- a/libpthread/linuxthreads/forward.c
+++ b/libpthread/linuxthreads/forward.c
@@ -24,6 +24,10 @@
 /* psm: keep this before internals.h */
 /* libc_hidden_proto(exit) */
 
+#define hidden_strong_alias(name, aliasname) \
+  extern __typeof (name) aliasname __attribute__ ((alias (#name), \
+                                                   visibility ("hidden")));
+
 #include "internals.h"
 
 /* Pointers to the libc functions.  */
@@ -104,8 +108,7 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
 
 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
 FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
-strong_alias (__pthread_exit, pthread_exit)
-
+hidden_strong_alias (__pthread_exit, pthread_exit)
 
 FORWARD (pthread_getschedparam,
 	 (pthread_t target_thread, int *policy, struct sched_param *param),
@@ -120,16 +123,16 @@ FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
 FORWARD (pthread_mutex_init,
 	 (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
 	 (mutex, mutexattr), 0)
-strong_alias(pthread_mutex_init, __pthread_mutex_init)
+hidden_strong_alias(pthread_mutex_init, __pthread_mutex_init)
 
 FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
-strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+hidden_strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
 
 FORWARD (pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), 0)
-strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock)
+hidden_strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock)
 
 FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
-strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+hidden_strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
 
 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
 
diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h
index eb0a519..4ad6a0d 100644
--- a/libpthread/linuxthreads/internals.h
+++ b/libpthread/linuxthreads/internals.h
@@ -380,6 +380,17 @@ extern int __pthread_setschedparam (pthread_t thread, int policy,
 extern int __pthread_setcancelstate (int state, int * oldstate);
 extern int __pthread_setcanceltype (int type, int * oldtype);
 
+extern void __pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
+                                    void (*__routine) (void *),
+                                    void *__arg) __THROW;
+extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
+                                   int __execute) __THROW;
+extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
+                                          void (*__routine) (void *),
+                                          void *__arg) __THROW;
+extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
+                                           int __execute) __THROW;
+
 extern void __pthread_restart_old(pthread_descr th);
 extern void __pthread_suspend_old(pthread_descr self);
 extern int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime);
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index 4d1d906..012b74b 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -280,10 +280,10 @@ struct pthread_functions __pthread_functions =
     .ptr_pthread_sigaction = __pthread_sigaction,
     .ptr_pthread_sigwait = __pthread_sigwait,
     .ptr_pthread_raise = __pthread_raise,
-    .ptr__pthread_cleanup_push = _pthread_cleanup_push,
-    .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
-    .ptr__pthread_cleanup_pop = _pthread_cleanup_pop,
-    .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
+    .ptr__pthread_cleanup_push = __pthread_cleanup_push,
+    .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
+    .ptr__pthread_cleanup_pop = __pthread_cleanup_pop,
+    .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
   };
 #ifdef SHARED
 # define ptr_pthread_functions &__pthread_functions