loader: Use a hidden function instead of an exported global variable to setup pthread functions.

oldstable
Alexandre Julliard 2008-11-07 11:11:21 +01:00
parent 912e4d4def
commit 17ab587567
4 changed files with 17 additions and 4 deletions

View File

@ -324,7 +324,7 @@ static void DECLSPEC_NORETURN abort_thread( long status )
/*********************************************************************** /***********************************************************************
* pthread_functions * pthread_functions
*/ */
const struct wine_pthread_functions pthread_functions = static const struct wine_pthread_functions pthread_functions =
{ {
init_process, init_process,
init_thread, init_thread,
@ -336,6 +336,10 @@ const struct wine_pthread_functions pthread_functions =
sigprocmask sigprocmask
}; };
void init_pthread_functions(void)
{
wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) );
}
/* Currently this probably works only for glibc2, /* Currently this probably works only for glibc2,
* which checks for the presence of double-underscore-prepended * which checks for the presence of double-underscore-prepended

View File

@ -106,7 +106,7 @@ int main( int argc, char *argv[] )
reserve_area( wine_main_preload_info[i].addr, wine_main_preload_info[i].size ); reserve_area( wine_main_preload_info[i].addr, wine_main_preload_info[i].size );
} }
wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) ); init_pthread_functions();
wine_init( argc, argv, error, sizeof(error) ); wine_init( argc, argv, error, sizeof(error) );
fprintf( stderr, "wine: failed to initialize: %s\n", error ); fprintf( stderr, "wine: failed to initialize: %s\n", error );
exit(1); exit(1);

View File

@ -30,6 +30,10 @@ struct wine_preload_info
size_t size; size_t size;
}; };
extern const struct wine_pthread_functions pthread_functions; #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
extern void init_pthread_functions(void) __attribute__((visibility ("hidden")));
#else
extern void init_pthread_functions(void);
#endif
#endif /* __WINE_LOADER_MAIN_H */ #endif /* __WINE_LOADER_MAIN_H */

View File

@ -246,7 +246,7 @@ static int pthread_sigmask( int how, const sigset_t *newset, sigset_t *oldset )
/*********************************************************************** /***********************************************************************
* pthread_functions * pthread_functions
*/ */
const struct wine_pthread_functions pthread_functions = static const struct wine_pthread_functions pthread_functions =
{ {
init_process, init_process,
init_thread, init_thread,
@ -257,3 +257,8 @@ const struct wine_pthread_functions pthread_functions =
abort_thread, abort_thread,
pthread_sigmask pthread_sigmask
}; };
void init_pthread_functions(void)
{
wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) );
}