(__libc_start_main): Initialize thread library for static programs

This commit is contained in:
Andreas Jaeger 2000-07-06 21:16:06 +00:00
parent 394d3277fb
commit 4fb7a71f12
1 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,10 @@ weak_extern (_dl_starting_up)
extern int __libc_multiple_libcs; extern int __libc_multiple_libcs;
extern void *__libc_stack_end; extern void *__libc_stack_end;
#ifndef SHARED
extern void __pthread_initialize_minimal (void) __attribute__ ((weak));
#endif
/* Prototype for local function. */ /* Prototype for local function. */
extern void __libc_check_standard_fds (void); 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; __libc_stack_end = stack_end;
#ifndef SHARED #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 /* Some security at this point. Prevent starting a SUID binary where
the standard file descriptors are not opened. We have to do this the standard file descriptors are not opened. We have to do this
only for statically linked applications since otherwise the dynamic only for statically linked applications since otherwise the dynamic