]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 20 Aug 2002 10:14:15 +0000 (10:14 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 20 Aug 2002 10:14:15 +0000 (10:14 +0000)
* elf/rtld.c (_dl_start): Pass extra argument 1 to TLS_INIT_TP.
(dl_main): Padd extra argument 0 to TLS_INIT_TP.
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Pass extra
argument 1 to TLS_INIT_TP.
* sysdeps/generic/tls.h (TLS_INIT_TP): Describe new parameter.

* locale/loadarchive.c (_nl_load_locale_from_archive): Store strdup of

ChangeLog
elf/rtld.c
linuxthreads/ChangeLog
linuxthreads/sysdeps/i386/tls.h
linuxthreads/sysdeps/sh/tls.h
sysdeps/generic/libc-tls.c
sysdeps/generic/tls.h

index 9ebb06c63cb339b3a4861fe4c767fb1ad1dc265a..6116116ce87dfd675cc5ea6409627b2dc9fa9552 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2002-08-20  Ulrich Drepper  <drepper@redhat.com>
 
+       * elf/rtld.c (_dl_start): Pass extra argument 1 to TLS_INIT_TP.
+       (dl_main): Padd extra argument 0 to TLS_INIT_TP.
+       * sysdeps/generic/libc-tls.c (__libc_setup_tls): Pass extra
+       argument 1 to TLS_INIT_TP.
+       * sysdeps/generic/tls.h (TLS_INIT_TP): Describe new parameter.
+
        * sysdeps/generic/dl-tls.c (allocate_dtv): Optimize a bit.
 
        * elf/Versions [ld] (GLIBC_PRIVATE): Add _dl_get_tls_static_info.
@@ -47,7 +53,7 @@
        * libio/tst-mmap-offend.c: New file.
        * libio/Makefile (tests): Add it.
 
-       * locale/loadarchive.c (_nl_load_locale_from_archive) Store strdup of
+       * locale/loadarchive.c (_nl_load_locale_from_archive): Store strdup of
        the name as passed, rather than the name in the archive dictionary.
 
 2002-08-15  Ulrich Drepper  <drepper@redhat.com>
index 5c426000ad797b52db163cdd61bc435f083a9afa..ab02a71ea36b492af50f6393da086e0a79eb6632 100644 (file)
@@ -262,11 +262,12 @@ _dl_start (void *arg)
        INSTALL_DTV ((char *) tlsblock + bootstrap_map.l_tls_offset,
                     initdtv);
 
-       if (TLS_INIT_TP ((char *) tlsblock + bootstrap_map.l_tls_offset) != 0)
+       if (TLS_INIT_TP ((char *) tlsblock + bootstrap_map.l_tls_offset, 1)
+           != 0)
          _dl_fatal_printf ("cannot setup thread-local storage\n");
 # elif TLS_DTV_AT_TP
        INSTALL_DTV (tlsblock, initdtv);
-       if (TLS_INIT_TP (tlsblock) != 0)
+       if (TLS_INIT_TP (tlsblock, 1) != 0)
          _dl_fatal_printf ("cannot setup thread-local storage\n");
 # else
 #  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
@@ -1475,7 +1476,7 @@ cannot allocate TLS data structures for initial thread");
       _dl_allocate_tls_init (tcbp);
 
       /* And finally install it for the main thread.  */
-      TLS_INIT_TP (tcbp);
+      TLS_INIT_TP (tcbp, 0);
     }
 #endif
 
index 6b6195b7d249e73f1f8684a0ae253b5389f2f16b..93a71d74e63915ac1f71cb42c56029273f63c0ad 100644 (file)
@@ -1,5 +1,14 @@
 2002-08-20  Ulrich Drepper  <drepper@redhat.com>
 
+       * sysdeps/i386/tls.h (TLS_INIT_TP): Add new parameter and pass it on
+       to TLS_SETUP_GS_SEGMENT.
+       (TLS_SETUP_GS_SEGMENT): Add new parameter and pass it on to
+       TLS_DO_SET_THREAD_AREA.
+       (TLS_DO_SET_THREAD_AREA): If new parameter is zero determine
+       entry number from %gs value.
+       * sysdeps/sh/tls.h (TLS_INIT_TP): Add new parameter and simply
+       ignore it.
+
        * manager.c (pthread_handle_create): Pass NULL to _dl_allocate_tls.
        Pass true to _dl_deallocate_tls.
        (pthread_free): Likewise.
index 5de8eca18d5deaa81b06592213a8c9c6cc047ca6..098b11caa0009cb8b5cc839fe6cf21f38056a8bc 100644 (file)
@@ -115,12 +115,16 @@ typedef struct
   __builtin_expect (result, 0) != 0 ? -1 : nr * 8 + 7;                       \
 })
 
-#  define TLS_DO_SET_THREAD_AREA(descr)                                              \
+#  define TLS_DO_SET_THREAD_AREA(descr, firstcall)                           \
 ({                                                                           \
   struct modify_ldt_ldt_s ldt_entry =                                        \
     { -1, (unsigned long int) (descr), sizeof (struct _pthread_descr_struct), \
       1, 0, 0, 0, 0, 1, 0 };                                                 \
   int result;                                                                \
+  if (!firstcall)                                                            \
+    ldt_entry.entry_number = ({ int _gs;                                     \
+                               asm ("movw %%gs, %w0" : "=q" (_gs));          \
+                               (_gs & 0xffff) >> 3; });                      \
   asm volatile (TLS_LOAD_EBX                                                 \
                "int $0x80\n\t"                                               \
                TLS_LOAD_EBX                                                  \
@@ -134,10 +138,11 @@ typedef struct
 })
 
 #  ifdef __ASSUME_SET_THREAD_AREA_SYSCALL
-#   define TLS_SETUP_GS_SEGMENT(descr) TLS_DO_SET_THREAD_AREA (descr)
+#   define TLS_SETUP_GS_SEGMENT(descr, firstcall) \
+  TLS_DO_SET_THREAD_AREA (descr, firstcall)
 #  elif defined __NR_set_thread_area
-#   define TLS_SETUP_GS_SEGMENT(descr) \
-  ({ int __seg = TLS_DO_SET_THREAD_AREA (descr); \
+#   define TLS_SETUP_GS_SEGMENT(descr, firstcall) \
+  ({ int __seg = TLS_DO_SET_THREAD_AREA (descr, firstcall); \
      __seg == -1 ? TLS_DO_MODIFY_LDT (descr, 0) : __seg; })
 #  else
 #   define TLS_SETUP_GS_SEGMENT(descr) TLS_DO_MODIFY_LDT ((descr), 0)
@@ -146,7 +151,7 @@ typedef struct
 /* Code to initially initialize the thread pointer.  This might need
    special attention since 'errno' is not yet available and if the
    operation can cause a failure 'errno' must not be touched.  */
-#  define TLS_INIT_TP(descr)                                                 \
+#  define TLS_INIT_TP(descr, firstcall)                                              \
   ({                                                                         \
     void *_descr = (descr);                                                  \
     tcbhead_t *head = _descr;                                                \
@@ -156,7 +161,7 @@ typedef struct
     /* For now the thread descriptor is at the same address.  */             \
     head->self = _descr;                                                     \
                                                                              \
-    __gs = TLS_SETUP_GS_SEGMENT (_descr);                                    \
+    __gs = TLS_SETUP_GS_SEGMENT (_descr, firstcall);                         \
     if (__builtin_expect (__gs, 7) != -1)                                    \
       {                                                                              \
        asm ("movw %w0, %%gs" : : "q" (__gs));                                \
index 6deecc007eeca62788bc509bdd75a0eaf89971b3..dce57a896137db2820dacad450e92b82254e52a9 100644 (file)
@@ -87,7 +87,7 @@ typedef struct
 /* Code to initially initialize the thread pointer.  This might need
    special attention since 'errno' is not yet available and if the
    operation can cause a failure 'errno' must not be touched.  */
-# define TLS_INIT_TP(descr) \
+# define TLS_INIT_TP(descr, firstcall) \
   ({                                                                         \
     void *_descr = (descr);                                                  \
     int result;                                                                      \
index 51b85ef28f0f75ed8fcad4e8b9b01742bdaa1bb7..88b0ccf8fcd538683ff03a6d41ddb7945fe3d9ed 100644 (file)
@@ -137,10 +137,10 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
 
   INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
 
-  TLS_INIT_TP ((char *) tlsblock + tcb_offset);
+  TLS_INIT_TP ((char *) tlsblock + tcb_offset, 1);
 # elif TLS_DTV_AT_TP
   INSTALL_DTV (tlsblock, static_dtv);
-  TLS_INIT_TP (tlsblock);
+  TLS_INIT_TP (tlsblock, 1);
 # else
 #  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
 # endif
index 38f84acd46ae59a1b41bf81b42f1d9c3b998db3e..6a23ec05e1be507d9b710a13fb62831db37ea2fd 100644 (file)
      use the value.
 
 
-     TLS_INIT_TP(tcb)
+     TLS_INIT_TP(tcb, firstcall)
 
      This macro must initialize the thread pointer to enable normal TLS
-     operation.  The parameter is a pointer to the thread control block.
+     operation.  The first parameter is a pointer to the thread control
+     block.  The second parameter specifies whether this is the first
+     call for the TCB.  ld.so calls this macro more than once.
 
 
      THREAD_DTV()