Use explicit function pointers for pthread support instead of relying
on ELF symbol overriding.
diff --git a/loader/kthread.c b/loader/kthread.c
index 368410e..4235b10 100644
--- a/loader/kthread.c
+++ b/loader/kthread.c
@@ -75,7 +75,7 @@
#define PSTR(str) __ASM_NAME(#str)
-static struct wine_pthread_functions funcs;
+static struct wine_pthread_callbacks funcs;
/* thread descriptor */
@@ -200,23 +200,23 @@
/***********************************************************************
- * wine_pthread_init_process
+ * init_process
*
* Initialization for a newly created process.
*/
-void wine_pthread_init_process( const struct wine_pthread_functions *functions )
+static void init_process( const struct wine_pthread_callbacks *callbacks, size_t size )
{
- memcpy( &funcs, functions, min(functions->size,sizeof(funcs)) );
+ memcpy( &funcs, callbacks, min( size, sizeof(funcs) ));
funcs.ptr_set_thread_data( &initial_descr );
}
/***********************************************************************
- * wine_pthread_init_thread
+ * init_thread
*
* Initialization for a newly created thread.
*/
-void wine_pthread_init_thread( struct wine_pthread_thread_info *info )
+static void init_thread( struct wine_pthread_thread_info *info )
{
struct pthread_descr_struct *descr;
@@ -240,9 +240,9 @@
/***********************************************************************
- * wine_pthread_create_thread
+ * create_thread
*/
-int wine_pthread_create_thread( struct wine_pthread_thread_info *info )
+static int create_thread( struct wine_pthread_thread_info *info )
{
if (!info->stack_base)
{
@@ -291,11 +291,11 @@
/***********************************************************************
- * wine_pthread_init_current_teb
+ * init_current_teb
*
* Set the current TEB for a new thread.
*/
-void wine_pthread_init_current_teb( struct wine_pthread_thread_info *info )
+static void init_current_teb( struct wine_pthread_thread_info *info )
{
#ifdef __i386__
/* On the i386, the current thread is in the %fs register */
@@ -319,7 +319,7 @@
/* FIXME: On Alpha, the current TEB is not accessible to user-space */
/* __asm__ __volatile__();*/
#else
-# error You must implement wine_pthread_init_current_teb for your platform
+# error You must implement init_current_teb for your platform
#endif
/* set pid and tid */
@@ -333,9 +333,9 @@
/***********************************************************************
- * wine_pthread_get_current_teb
+ * get_current_teb
*/
-void *wine_pthread_get_current_teb(void)
+static void *get_current_teb(void)
{
void *ret;
@@ -358,7 +358,7 @@
"ldq $0,0($30)\n\t"
"lda $30,-8($30)" : "=r" (ret) );
#else
-# error wine_pthread_get_current_teb not defined for this architecture
+# error get_current_teb not defined for this architecture
#endif /* __i386__ */
return ret;
@@ -366,18 +366,18 @@
/***********************************************************************
- * wine_pthread_exit_thread
+ * exit_thread
*/
-void wine_pthread_exit_thread( struct wine_pthread_thread_info *info )
+static void DECLSPEC_NORETURN exit_thread( struct wine_pthread_thread_info *info )
{
wine_switch_to_stack( cleanup_thread, info, get_temp_stack() );
}
/***********************************************************************
- * wine_pthread_abort_thread
+ * abort_thread
*/
-void wine_pthread_abort_thread( int status )
+static void DECLSPEC_NORETURN abort_thread( int status )
{
#ifdef HAVE__LWP_CREATE
_lwp_exit();
@@ -386,6 +386,21 @@
}
+/***********************************************************************
+ * pthread_functions
+ */
+const struct wine_pthread_functions pthread_functions =
+{
+ init_process,
+ init_thread,
+ create_thread,
+ init_current_teb,
+ get_current_teb,
+ exit_thread,
+ abort_thread
+};
+
+
/* Currently this probably works only for glibc2,
* which checks for the presence of double-underscore-prepended
* pthread primitives, and use them if available.