summary refs log tree commit diff
path: root/csu/libc-start.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
commit32c075e1f01849e161724bbd400ba77244e482cc (patch)
tree5f083a3f352104f32bb6c902d57fa3f294bd8d4d /csu/libc-start.c
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
downloadglibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.gz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.xz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.zip
.
Diffstat (limited to 'csu/libc-start.c')
-rw-r--r--csu/libc-start.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 634844759d..194db6b1ec 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,11 @@ extern int __libc_multiple_libcs;
 #include <tls.h>
 #ifndef SHARED
 # include <dl-osinfo.h>
-extern void __pthread_initialize_minimal (void);
+extern void __pthread_initialize_minimal (void)
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+     __attribute__ ((weak))
+# endif
+     ;
 # ifndef THREAD_SET_STACK_GUARD
 /* Only exported for architectures that don't store the stack guard canary
    in thread local area.  */
@@ -136,8 +140,13 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
 
   /* 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.  */
-  __pthread_initialize_minimal ();
+     we need to setup errno.  If there is no thread library and we
+     handle TLS the function is defined in the libc to initialized the
+     TLS handling.  */
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+  if (__pthread_initialize_minimal)
+# endif
+    __pthread_initialize_minimal ();
 #endif
 
 # ifndef SHARED