Module: wine Branch: master Commit: 17ab5875673c4fe50a8e9390733b41af1826d63c URL: http://source.winehq.org/git/wine.git/?a=commit;h=17ab5875673c4fe50a8e939073...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Nov 7 11:11:21 2008 +0100
loader: Use a hidden function instead of an exported global variable to setup pthread functions.
---
loader/kthread.c | 6 +++++- loader/main.c | 2 +- loader/main.h | 6 +++++- loader/pthread.c | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/loader/kthread.c b/loader/kthread.c index acfa10f..c791ef6 100644 --- a/loader/kthread.c +++ b/loader/kthread.c @@ -324,7 +324,7 @@ static void DECLSPEC_NORETURN abort_thread( long status ) /*********************************************************************** * pthread_functions */ -const struct wine_pthread_functions pthread_functions = +static const struct wine_pthread_functions pthread_functions = { init_process, init_thread, @@ -336,6 +336,10 @@ const struct wine_pthread_functions pthread_functions = sigprocmask };
+void init_pthread_functions(void) +{ + wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) ); +}
/* Currently this probably works only for glibc2, * which checks for the presence of double-underscore-prepended diff --git a/loader/main.c b/loader/main.c index 289eb68..314398d 100644 --- a/loader/main.c +++ b/loader/main.c @@ -106,7 +106,7 @@ int main( int argc, char *argv[] ) 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) ); fprintf( stderr, "wine: failed to initialize: %s\n", error ); exit(1); diff --git a/loader/main.h b/loader/main.h index 8284477..0c6fc84 100644 --- a/loader/main.h +++ b/loader/main.h @@ -30,6 +30,10 @@ struct wine_preload_info 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 */ diff --git a/loader/pthread.c b/loader/pthread.c index dd1a3ba..4951d97 100644 --- a/loader/pthread.c +++ b/loader/pthread.c @@ -246,7 +246,7 @@ static int pthread_sigmask( int how, const sigset_t *newset, sigset_t *oldset ) /*********************************************************************** * pthread_functions */ -const struct wine_pthread_functions pthread_functions = +static const struct wine_pthread_functions pthread_functions = { init_process, init_thread, @@ -257,3 +257,8 @@ const struct wine_pthread_functions pthread_functions = abort_thread, pthread_sigmask }; + +void init_pthread_functions(void) +{ + wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) ); +}