summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--FAQ.in20
-rw-r--r--elf/dl-close.c35
-rw-r--r--elf/dl-deps.c9
-rw-r--r--elf/dl-open.c6
5 files changed, 32 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 7da39088bb..eabeacea34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1999-01-21  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/dl-close.c: Rewrite the way adding to the global scope works
+	to handle error cases better than the last change.
+	The l_global flag is now only set when the object is actually
+	counted in the global scope list.
+	* elf/dl-deps.c: Likewise.
+	* elf/dl-open.c: Likewise.
+
 1999-01-20  Philip Blundell  <pb@nexus.co.uk>
 
 	* sysdeps/unix/sysv/linux/arm/sigaction.c: New file.
diff --git a/FAQ.in b/FAQ.in
index b142f5bd2d..788c50e2e8 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -849,16 +849,16 @@ Another problem is that older binaries that were linked statically against
 glibc 2.0 will reference the older nss modules (libnss_files.so.1 instead of
 libnss_files.so.2), so don't remove them.  Also, the old glibc-2.0 compiled
 static libraries (libfoo.a) which happen to depend on the older libio
-behavior will be broken by the glibc 2.1 upgrade.  The idea is to produce a
-libcompat.a that people will be able to use to link in if they want to
-compile a static library generated against glibc 2.0 into a program on a
-glibc 2.1 system.  You should just add -lcompat and you should be fine.
-
-The glibc-compat add-on will provide the libnss_* files and other stuff so
-that it is possible to use static library compiled against glibc 2.0 for
-development on a glibc 2.1 based system.  Please note that this is currently
-just an experiment, although the nss modules part should work.
-
+behavior will be broken by the glibc 2.1 upgrade.  We plan to produce a
+compatibility library that people will be able to link in if they want
+to compile a static library generated against glibc 2.0 into a program
+on a glibc 2.1 system.  You just add -lcompat and you should be fine.
+
+The glibc-compat add-on will provide the libcompat.a library, the older
+nss modules, and a few other files.  Together, they should make it
+possible to do development with old static libraries on a glibc 2.1
+system.  This add-on is still in development.  You can get it from <URL>
+but please keep in mind that it is experimental.
 
 ? Source and binary incompatibilities, and what to do about them
 
diff --git a/elf/dl-close.c b/elf/dl-close.c
index a56c14400c..d7a61c4535 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -106,36 +106,15 @@ _dl_close (struct link_map *map)
 	      int cnt = _dl_main_searchlist->r_nlist;
 
 	      do
-		if (--cnt < 0)
-		  break;
+		--cnt;
 	      while (_dl_main_searchlist->r_list[cnt] != imap);
 
-	      if (cnt >= 0)
-		{
-		  /* The object was already correctly registered.  */
-		  while (++cnt < _dl_main_searchlist->r_nlist)
-		    _dl_main_searchlist->r_list[cnt - 1]
-		      = _dl_main_searchlist->r_list[cnt];
-
-		  --_dl_main_searchlist->r_nlist;
-		}
-	      else
-		{
-		  /* This can happen if loading was interrupted by something
-		     like a missing symbol in the newly loaded objects.  In
-		     this case the object is already marked as global but
-		     `r_nlist' does not count it in.  The pointer is in the
-		     `r_list' array so we keep searching in the other
-		     direction.  */
-		  cnt = _dl_main_searchlist->r_nlist;
-		  while (_dl_main_searchlist->r_list[cnt] != imap)
-		    {
-		      ++cnt;
-		      /* Note that if _dl_global_scope_alloc is zero we
-			 should never come here in the first place.  */
-		      assert (cnt < _dl_global_scope_alloc);
-		    }
-		}
+	      /* The object was already correctly registered.  */
+	      while (++cnt < _dl_main_searchlist->r_nlist)
+		_dl_main_searchlist->r_list[cnt - 1]
+		  = _dl_main_searchlist->r_list[cnt];
+
+	      --_dl_main_searchlist->r_nlist;
 	    }
 
 	  /* We can unmap all the maps at once.  We determined the
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 04c4010b65..355618ad1c 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
 /* Load the dependencies of a mapped object.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 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
@@ -93,6 +93,7 @@ _dl_map_object_deps (struct link_map *map,
   struct list known[1 + npreloads + 1];
   struct list *runp, *utail, *dtail;
   unsigned int nlist, nduplist, i;
+  unsigned int to_add = 0;
 
   inline void preload (struct link_map *map)
     {
@@ -416,7 +417,6 @@ _dl_map_object_deps (struct link_map *map,
   if (global_scope)
     {
       unsigned int cnt;
-      unsigned int to_add = 0;
       struct link_map **new_global;
 
       /* Count the objects we have to put in the global scope.  */
@@ -479,16 +479,13 @@ _dl_map_object_deps (struct link_map *map,
       for (cnt = 0; cnt < nlist; ++cnt)
 	if (map->l_searchlist.r_list[cnt]->l_global == 0)
 	  {
-	    map->l_searchlist.r_list[cnt]->l_global = 1;
 	    _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist + to_add]
 	      = map->l_searchlist.r_list[cnt];
 	    ++to_add;
 	  }
 
       /* XXX Do we have to add something to r_dupsearchlist???  --drepper */
-
-      return to_add;
     }
 
-  return 0;
+  return to_add;
 }
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 3db2b0e9f7..2b3352b674 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -144,9 +144,9 @@ dl_open_worker (void *a)
     (*(void (*) (int, char **, char **)) init) (__libc_argc, __libc_argv,
 						__environ);
 
-  if (new->l_global)
-    /* Now we can make the new map available in the global scope.  */
-    _dl_main_searchlist->r_nlist += global_add;
+  /* Now we can make the new map available in the global scope.  */
+  while (global_add-- > 0)
+    _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist++]->l_global = 1;
 
   if (_dl_sysdep_start == NULL)
     /* We must be the static _dl_open in libc.a.  A static program that