From 4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 6 Jul 2000 21:16:06 +0000 Subject: [PATCH] (__libc_start_main): Initialize thread library for static programs --- sysdeps/generic/libc-start.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index bc02d5c..a95ce56 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -29,6 +29,10 @@ weak_extern (_dl_starting_up) extern int __libc_multiple_libcs; extern void *__libc_stack_end; +#ifndef SHARED +extern void __pthread_initialize_minimal (void) __attribute__ ((weak)); +#endif + /* Prototype for local function. */ extern void __libc_check_standard_fds (void); @@ -62,6 +66,12 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **), __libc_stack_end = stack_end; #ifndef SHARED + /* Initialize the thread library at least a bit since the libgcc + functions are using thread functions if these are available and + we need to setup errno. */ + if (__pthread_initialize_minimal) + __pthread_initialize_minimal (); + /* Some security at this point. Prevent starting a SUID binary where the standard file descriptors are not opened. We have to do this only for statically linked applications since otherwise the dynamic -- 2.7.4