aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-07-06 21:16:06 +0000
committerAndreas Jaeger <aj@suse.de>2000-07-06 21:16:06 +0000
commit4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2 (patch)
tree77ed9480c2c0870ef0f5b0bc817173dd0975896d
parent394d3277fbe2ea8282984ead468370c1eb4b7d4d (diff)
downloadglibc-4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2.tar
glibc-4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2.tar.gz
glibc-4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2.tar.bz2
glibc-4fb7a71f12d6cb9e4cb696799f3d4505cfe80bf2.zip
(__libc_start_main): Initialize thread library for static programs
-rw-r--r--sysdeps/generic/libc-start.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index bc02d5ce27..a95ce56d2b 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