hurd: Fix link cthread/pthread symbol exposition.

* hurd/Versions (HURD_CTHREADS_0.3): Rename weak refs cthread_fork,
	cthread_detach, pthread_getattr_np, pthread_attr_getstack,
	cthread_keycreate, cthread_getspecific, cthread_setspecific to
	__cthread_fork, __cthread_detach, __pthread_getattr_np,
	__pthread_attr_getstack, __cthread_keycreate, __cthread_getspecific,
	__cthread_setspecific.
	* hurd/hurdsig.c (_hurdsig_init): Use __cthread_fork,
	__cthread_detach, __pthread_getattr_np, __pthread_attr_getstack,
	__cthread_t instead of cthread_fork, cthread_detach,
	pthread_getattr_np, pthread_attr_getstack.
	* sysdeps/mach/hurd/cthreads.c (cthread_keycreate): Rename to
	__cthread_keycreate.
	(cthread_getspecific): Rename to __cthread_getspecific.
	(cthread_setspecific): Rename to __cthread_setspecific.
	(__libc_getspecific): Use __cthread_getspecific instead of
	cthread_getspecific.
	* sysdeps/mach/hurd/libc-lock.h (__libc_key_create): Use
	__cthread_keycreate instead of cthread_keycreate.
	(__libc_setspecific): Use __cthread_setspecific instead of
	cthread_setspecific.
	* sysdeps/mach/libc-lock.h (__libc_key_create, __libc_setspecific):
	Likewise.
This commit is contained in:
Samuel Thibault 2018-03-17 23:53:39 +01:00
parent dc33bef307
commit c2fb08c78a
6 changed files with 44 additions and 22 deletions

View File

@ -78,6 +78,28 @@
(__mig_dealloc_reply_port): Likewise. (__mig_dealloc_reply_port): Likewise.
(__mig_init): Do not initialize threadvar. (__mig_init): Do not initialize threadvar.
* sysdeps/mach/hurd/profil.c: Fix comment. * sysdeps/mach/hurd/profil.c: Fix comment.
* hurd/Versions (HURD_CTHREADS_0.3): Rename weak refs cthread_fork,
cthread_detach, pthread_getattr_np, pthread_attr_getstack,
cthread_keycreate, cthread_getspecific, cthread_setspecific to
__cthread_fork, __cthread_detach, __pthread_getattr_np,
__pthread_attr_getstack, __cthread_keycreate, __cthread_getspecific,
__cthread_setspecific.
* hurd/hurdsig.c (_hurdsig_init): Use __cthread_fork,
__cthread_detach, __pthread_getattr_np, __pthread_attr_getstack,
__cthread_t instead of cthread_fork, cthread_detach,
pthread_getattr_np, pthread_attr_getstack.
* sysdeps/mach/hurd/cthreads.c (cthread_keycreate): Rename to
__cthread_keycreate.
(cthread_getspecific): Rename to __cthread_getspecific.
(cthread_setspecific): Rename to __cthread_setspecific.
(__libc_getspecific): Use __cthread_getspecific instead of
cthread_getspecific.
* sysdeps/mach/hurd/libc-lock.h (__libc_key_create): Use
__cthread_keycreate instead of cthread_keycreate.
(__libc_setspecific): Use __cthread_setspecific instead of
cthread_setspecific.
* sysdeps/mach/libc-lock.h (__libc_key_create, __libc_setspecific):
Likewise.
2018-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org> 2018-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org>

View File

@ -139,14 +139,14 @@ libc {
HURD_CTHREADS_0.3 { HURD_CTHREADS_0.3 {
# weak refs to libthreads functions that libc calls iff libthreads in use # weak refs to libthreads functions that libc calls iff libthreads in use
cthread_fork; cthread_detach; __cthread_fork; __cthread_detach;
pthread_getattr_np; pthread_attr_getstack; __pthread_getattr_np; __pthread_attr_getstack;
# variables used for detecting cthreads # variables used for detecting cthreads
_cthread_exit_routine; _cthread_init_routine; _cthread_exit_routine; _cthread_init_routine;
# cthreads functions with stubs in libc # cthreads functions with stubs in libc
cthread_keycreate; cthread_getspecific; cthread_setspecific; __cthread_keycreate; __cthread_getspecific; __cthread_setspecific;
__libc_getspecific; __libc_getspecific;
} }
} }

View File

@ -1258,8 +1258,8 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
/* Start the signal thread listening on the message port. */ /* Start the signal thread listening on the message port. */
#pragma weak cthread_fork #pragma weak __cthread_fork
if (!cthread_fork) if (!__cthread_fork)
{ {
err = __thread_create (__mach_task_self (), &_hurd_msgport_thread); err = __thread_create (__mach_task_self (), &_hurd_msgport_thread);
assert_perror (err); assert_perror (err);
@ -1291,22 +1291,22 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
we'll let the signal thread's per-thread variables be found as for we'll let the signal thread's per-thread variables be found as for
any normal cthread, and just leave the magic __hurd_sigthread_* any normal cthread, and just leave the magic __hurd_sigthread_*
values all zero so they'll be ignored. */ values all zero so they'll be ignored. */
#pragma weak cthread_detach #pragma weak __cthread_detach
#pragma weak pthread_getattr_np #pragma weak __pthread_getattr_np
#pragma weak pthread_attr_getstack #pragma weak __pthread_attr_getstack
cthread_t thread = cthread_fork ((cthread_fn_t) &_hurd_msgport_receive, __cthread_t thread = __cthread_fork (
0); (cthread_fn_t) &_hurd_msgport_receive, 0);
cthread_detach (thread); __cthread_detach (thread);
if (pthread_getattr_np) if (__pthread_getattr_np)
{ {
/* Record signal thread stack layout for fork() */ /* Record signal thread stack layout for fork() */
pthread_attr_t attr; pthread_attr_t attr;
void *addr; void *addr;
size_t size; size_t size;
pthread_getattr_np ((pthread_t) thread, &attr); __pthread_getattr_np ((pthread_t) thread, &attr);
pthread_attr_getstack (&attr, &addr, &size); __pthread_attr_getstack (&attr, &addr, &size);
__hurd_sigthread_stack_base = (uintptr_t) addr; __hurd_sigthread_stack_base = (uintptr_t) addr;
__hurd_sigthread_stack_end = __hurd_sigthread_stack_base + size; __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + size;
} }

View File

@ -26,7 +26,7 @@ char __libc_lock_self0[0];
/* Placeholder for key creation routine from Hurd cthreads library. */ /* Placeholder for key creation routine from Hurd cthreads library. */
int int
weak_function weak_function
cthread_keycreate (cthread_key_t *key) __cthread_keycreate (cthread_key_t *key)
{ {
__set_errno (ENOSYS); __set_errno (ENOSYS);
*key = -1; *key = -1;
@ -36,7 +36,7 @@ cthread_keycreate (cthread_key_t *key)
/* Placeholder for key retrieval routine from Hurd cthreads library. */ /* Placeholder for key retrieval routine from Hurd cthreads library. */
int int
weak_function weak_function
cthread_getspecific (cthread_key_t key, void **pval) __cthread_getspecific (cthread_key_t key, void **pval)
{ {
*pval = NULL; *pval = NULL;
__set_errno (ENOSYS); __set_errno (ENOSYS);
@ -46,7 +46,7 @@ cthread_getspecific (cthread_key_t key, void **pval)
/* Placeholder for key setting routine from Hurd cthreads library. */ /* Placeholder for key setting routine from Hurd cthreads library. */
int int
weak_function weak_function
cthread_setspecific (cthread_key_t key, void *val) __cthread_setspecific (cthread_key_t key, void *val)
{ {
__set_errno (ENOSYS); __set_errno (ENOSYS);
return -1; return -1;
@ -58,6 +58,6 @@ void *
__libc_getspecific (cthread_key_t key) __libc_getspecific (cthread_key_t key)
{ {
void *val; void *val;
cthread_getspecific (key, &val); __cthread_getspecific (key, &val);
return val; return val;
} }

View File

@ -201,8 +201,8 @@ struct __libc_once
/* Type for key of thread specific data. */ /* Type for key of thread specific data. */
typedef cthread_key_t __libc_key_t; typedef cthread_key_t __libc_key_t;
#define __libc_key_create(KEY,DEST) cthread_keycreate (KEY) #define __libc_key_create(KEY,DEST) __cthread_keycreate (KEY)
#define __libc_setspecific(KEY,VAL) cthread_setspecific (KEY, VAL) #define __libc_setspecific(KEY,VAL) __cthread_setspecific (KEY, VAL)
void *__libc_getspecific (__libc_key_t key); void *__libc_getspecific (__libc_key_t key);
#endif /* _CTHREADS_ */ #endif /* _CTHREADS_ */

View File

@ -124,8 +124,8 @@ struct __libc_once
#define __libc_mutex_unlock __mutex_unlock #define __libc_mutex_unlock __mutex_unlock
#endif #endif
#define __libc_key_create(KEY,DEST) cthread_keycreate (KEY) #define __libc_key_create(KEY,DEST) __cthread_keycreate (KEY)
#define __libc_setspecific(KEY,VAL) cthread_setspecific (KEY, VAL) #define __libc_setspecific(KEY,VAL) __cthread_setspecific (KEY, VAL)
void *__libc_getspecific (__libc_key_t key); void *__libc_getspecific (__libc_key_t key);
/* XXX until cthreads supports recursive locks */ /* XXX until cthreads supports recursive locks */