Revert l_scope name changes.
authordrepper <drepper>
Fri, 27 Oct 2006 15:20:17 +0000 (15:20 +0000)
committerdrepper <drepper>
Fri, 27 Oct 2006 15:20:17 +0000 (15:20 +0000)
elf/dl-close.c
elf/dl-libc.c
elf/dl-load.c
elf/dl-object.c
elf/rtld.c

index bfcceea..31bc80b 100644 (file)
@@ -343,14 +343,14 @@ _dl_close (void *_map)
             one for the terminating NULL pointer.  */
          size_t remain = (new_list != NULL) + 1;
          bool removed_any = false;
-         for (size_t cnt = 0; imap->l_scoperec->scope[cnt] != NULL; ++cnt)
+         for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
            /* This relies on l_scope[] entries being always set either
               to its own l_symbolic_searchlist address, or some map's
               l_searchlist address.  */
-           if (imap->l_scoperec->scope[cnt] != &imap->l_symbolic_searchlist)
+           if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
              {
                struct link_map *tmap = (struct link_map *)
-                 ((char *) imap->l_scoperec->scope[cnt]
+                 ((char *) imap->l_scope[cnt]
                   - offsetof (struct link_map, l_searchlist));
                assert (tmap->l_ns == ns);
                if (tmap->l_idx == IDX_STILL_USED)
@@ -368,38 +368,35 @@ _dl_close (void *_map)
                 user of the current array.  If possible use the link map's
                 memory.  */
              size_t new_size;
-             struct r_scoperec *newp;
-             if (imap->l_scoperec != &imap->l_scoperec_mem
-                 && remain < NINIT_SCOPE_ELEMS (imap)
-                 && imap->l_scoperec_mem.nusers == 0)
+             struct r_scope_elem **newp;
+
+#define SCOPE_ELEMS(imap) \
+  (sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
+
+             if (imap->l_scope != imap->l_scope_mem
+                 && remain < SCOPE_ELEMS (imap))
                {
-                 new_size = NINIT_SCOPE_ELEMS (imap);
-                 newp = &imap->l_scoperec_mem;
+                 new_size = SCOPE_ELEMS (imap);
+                 newp = imap->l_scope_mem;
                }
              else
                {
                  new_size = imap->l_scope_max;
-                 newp = (struct r_scoperec *)
-                   malloc (sizeof (struct r_scoperec)
-                           + new_size * sizeof (struct r_scope_elem *));
+                 newp = (struct r_scope_elem **)
+                   malloc (new_size * sizeof (struct r_scope_elem *));
                  if (newp == NULL)
                    _dl_signal_error (ENOMEM, "dlclose", NULL,
                                      N_("cannot create scope list"));
                }
 
-             newp->nusers = 0;
-             newp->remove_after_use = false;
-             newp->notify = false;
-
              /* Copy over the remaining scope elements.  */
              remain = 0;
-             for (size_t cnt = 0; imap->l_scoperec->scope[cnt] != NULL; ++cnt)
+             for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
                {
-                 if (imap->l_scoperec->scope[cnt]
-                     != &imap->l_symbolic_searchlist)
+                 if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
                    {
                      struct link_map *tmap = (struct link_map *)
-                       ((char *) imap->l_scoperec->scope[cnt]
+                       ((char *) imap->l_scope[cnt]
                         - offsetof (struct link_map, l_searchlist));
                      if (tmap->l_idx != IDX_STILL_USED)
                        {
@@ -407,38 +404,30 @@ _dl_close (void *_map)
                             scope.  */
                          if (new_list != NULL)
                            {
-                             newp->scope[remain++] = new_list;
+                             newp[remain++] = new_list;
                              new_list = NULL;
                            }
                          continue;
                        }
                    }
 
-                 newp->scope[remain++] = imap->l_scoperec->scope[cnt];
+                 newp[remain++] = imap->l_scope[cnt];
                }
-             newp->scope[remain] = NULL;
+             newp[remain] = NULL;
 
-             struct r_scoperec *old = imap->l_scoperec;
+             struct r_scope_elem **old = imap->l_scope;
 
              if (SINGLE_THREAD_P)
-               imap->l_scoperec = newp;
+               imap->l_scope = newp;
              else
                {
-                 __rtld_mrlock_change (imap->l_scoperec_lock);
-                 imap->l_scoperec = newp;
-                 __rtld_mrlock_done (imap->l_scoperec_lock);
-
-                 if (atomic_increment_val (&old->nusers) != 1)
-                   {
-                     old->remove_after_use = true;
-                     old->notify = true;
-                     if (atomic_decrement_val (&old->nusers) != 0)
-                       __rtld_waitzero (old->nusers);
-                   }
+                 __rtld_mrlock_change (imap->l_scope_lock);
+                 imap->l_scope = newp;
+                 __rtld_mrlock_done (imap->l_scope_lock);
                }
 
              /* No user anymore, we can free it now.  */
-             if (old != &imap->l_scoperec_mem)
+             if (old != imap->l_scope_mem)
                free (old);
 
              imap->l_scope_max = new_size;
@@ -652,8 +641,8 @@ _dl_close (void *_map)
          free (imap->l_initfini);
 
          /* Remove the scope array if we allocated it.  */
-         if (imap->l_scoperec != &imap->l_scoperec_mem)
-           free (imap->l_scoperec);
+         if (imap->l_scope != imap->l_scope_mem)
+           free (imap->l_scope);
 
          if (imap->l_phdr_allocated)
            free ((void *) imap->l_phdr);
index 8b78a7a..a6d0d1f 100644 (file)
@@ -133,8 +133,7 @@ do_dlsym_private (void *ptr)
   struct do_dlsym_args *args = (struct do_dlsym_args *) ptr;
   args->ref = NULL;
   l = GLRO(dl_lookup_symbol_x) (args->name, args->map, &args->ref,
-                               args->map->l_scoperec->scope, &vers, 0, 0,
-                               NULL);
+                               args->map->l_scope, &vers, 0, 0, NULL);
   args->loadbase = l;
 }
 
index 172fb2f..36dc123 100644 (file)
@@ -1473,7 +1473,7 @@ cannot enable executable stack as shared object requires");
      have to do this for the main map.  */
   if ((mode & RTLD_DEEPBIND) == 0
       && __builtin_expect (l->l_info[DT_SYMBOLIC] != NULL, 0)
-      && &l->l_searchlist != l->l_scoperec->scope[0])
+      && &l->l_searchlist != l->l_scope[0])
     {
       /* Create an appropriate searchlist.  It contains only this map.
         This is the definition of DT_SYMBOLIC in SysVr4.  */
@@ -1490,11 +1490,11 @@ cannot enable executable stack as shared object requires");
       l->l_symbolic_searchlist.r_nlist = 1;
 
       /* Now move the existing entries one back.  */
-      memmove (&l->l_scoperec->scope[1], &l->l_scoperec->scope[0],
-              (l->l_scope_max - 1) * sizeof (l->l_scoperec->scope[0]));
+      memmove (&l->l_scope[1], &l->l_scope[0],
+              (l->l_scope_max - 1) * sizeof (l->l_scope[0]));
 
       /* Now add the new entry.  */
-      l->l_scoperec->scope[0] = &l->l_symbolic_searchlist;
+      l->l_scope[0] = &l->l_symbolic_searchlist;
     }
 
   /* Remember whether this object must be initialized first.  */
index c5dae9e..29f44bf 100644 (file)
@@ -82,13 +82,12 @@ _dl_new_object (char *realname, const char *libname, int type,
   /* Use the 'l_scope_mem' array by default for the the 'l_scope'
      information.  If we need more entries we will allocate a large
      array dynamically.  */
-  new->l_scoperec = &new->l_scoperec_mem;
-  new->l_scope_max = (sizeof (new->l_scope_realmem.scope_elems)
-                     / sizeof (new->l_scope_realmem.scope_elems[0]));
+  new->l_scope = new->l_scope_mem;
+  new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
 
   /* No need to initialize the scope lock if the initializer is zero.  */
 #if _RTLD_MRLOCK_INITIALIZER != 0
-  __rtld_mrlock_initialize (new->l_scoperec_mem.lock);
+  __rtld_mrlock_initialize (new->l_scope_lock);
 #endif
 
   /* Counter for the scopes we have to handle.  */
@@ -104,8 +103,7 @@ _dl_new_object (char *realname, const char *libname, int type,
       l->l_next = new;
 
       /* Add the global scope.  */
-      new->l_scoperec->scope[idx++]
-       = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
+      new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
     }
   else
     GL(dl_ns)[nsid]._ns_loaded = new;
@@ -121,15 +119,15 @@ _dl_new_object (char *realname, const char *libname, int type,
       loader = loader->l_loader;
 
   /* Insert the scope if it isn't the global scope we already added.  */
-  if (idx == 0 || &loader->l_searchlist != new->l_scoperec->scope[0])
+  if (idx == 0 || &loader->l_searchlist != new->l_scope[0])
     {
       if ((mode & RTLD_DEEPBIND) != 0 && idx != 0)
        {
-         new->l_scoperec->scope[1] = new->l_scoperec->scope[0];
+         new->l_scope[1] = new->l_scope[0];
          idx = 0;
        }
 
-      new->l_scoperec->scope[idx] = &loader->l_searchlist;
+      new->l_scope[idx] = &loader->l_searchlist;
     }
 
   new->l_local_scope[0] = &new->l_searchlist;
index ace3a30..bddd6ac 100644 (file)
@@ -609,7 +609,7 @@ relocate_doit (void *a)
 {
   struct relocate_args *args = (struct relocate_args *) a;
 
-  _dl_relocate_object (args->l, args->l->l_scoperec->scope, args->lazy, 0);
+  _dl_relocate_object (args->l, args->l->l_scope, args->lazy, 0);
 }
 
 static void
@@ -1963,7 +1963,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
            lookup_t result;
 
            result = _dl_lookup_symbol_x (INTUSE(_dl_argv)[i], main_map,
-                                         &ref, main_map->l_scoperec->scope,
+                                         &ref, main_map->l_scope,
                                          NULL, ELF_RTYPE_CLASS_PLT,
                                          DL_LOOKUP_ADD_DEPENDENCY, NULL);
 
@@ -2007,7 +2007,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
                  /* Mark the link map as not yet relocated again.  */
                  GL(dl_rtld_map).l_relocated = 0;
                  _dl_relocate_object (&GL(dl_rtld_map),
-                                      main_map->l_scoperec->scope, 0, 0);
+                                      main_map->l_scope, 0, 0);
                }
             }
 #define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
@@ -2227,7 +2227,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
            }
 
          if (l != &GL(dl_rtld_map))
-           _dl_relocate_object (l, l->l_scoperec->scope, GLRO(dl_lazy),
+           _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy),
                                 consider_profiling);
 
 #ifdef USE_TLS
@@ -2303,8 +2303,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
       HP_TIMING_NOW (start);
       /* Mark the link map as not yet relocated again.  */
       GL(dl_rtld_map).l_relocated = 0;
-      _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scoperec->scope,
-                          0, 0);
+      _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope, 0, 0);
       HP_TIMING_NOW (stop);
       HP_TIMING_DIFF (add, start, stop);
       HP_TIMING_ACCUM_NT (relocate_time, add);