summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c10
-rw-r--r--elf/dl-iteratephdr.c30
-rw-r--r--elf/dl-load.c14
-rw-r--r--elf/dl-support.c3
4 files changed, 8 insertions, 49 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c8ffcf8ebd..5bf1de7d28 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -643,9 +643,7 @@ _dl_close_worker (struct link_map *map)
 	    imap->l_prev->l_next = imap->l_next;
 	  else
 	    {
-#ifdef SHARED
 	      assert (nsid != LM_ID_BASE);
-#endif
 	      ns->_ns_loaded = imap->l_next;
 
 	      /* Update the pointer to the head of the list
@@ -736,13 +734,7 @@ _dl_close_worker (struct link_map *map)
   if (__builtin_expect (ns->_ns_loaded == NULL, 0)
       && nsid == GL(dl_nns) - 1)
     do
-      {
-	--GL(dl_nns);
-#ifndef SHARED
-	if (GL(dl_nns) == 0)
-	  break;
-#endif
-      }
+      --GL(dl_nns);
     while (GL(dl_ns)[GL(dl_nns) - 1]._ns_loaded == NULL);
 
   /* Notify the debugger those objects are finalized and gone.  */
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index 76e98aa2f1..6572ec3a33 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -86,34 +86,4 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 }
 hidden_def (__dl_iterate_phdr)
 
-#ifdef SHARED
-
 weak_alias (__dl_iterate_phdr, dl_iterate_phdr);
-
-#else
-
-int
-dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
-				  size_t size, void *data), void *data)
-{
-  if (_dl_phnum != 0)
-    {
-      /* This entry describes this statically-linked program itself.  */
-      struct dl_phdr_info info;
-      int ret;
-      info.dlpi_addr = 0;
-      info.dlpi_name = "";
-      info.dlpi_phdr = _dl_phdr;
-      info.dlpi_phnum = _dl_phnum;
-      info.dlpi_adds = GL(dl_load_adds);
-      info.dlpi_subs = GL(dl_load_adds) - GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
-      ret = (*callback) (&info, sizeof (struct dl_phdr_info), data);
-      if (ret)
-	return ret;
-    }
-
-  return __dl_iterate_phdr (callback, data);
-}
-
-
-#endif
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ee12f329d8..1be7a3ca96 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2233,23 +2233,17 @@ _dl_map_object (struct link_map *loader, const char *name,
 
 	  if (cached != NULL)
 	    {
-# ifdef SHARED
 	      // XXX Correct to unconditionally default to namespace 0?
 	      l = (loader
 		   ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded
-		   ?: &GL(dl_rtld_map));
-# else
-	      l = loader;
+# ifdef SHARED
+		   ?: &GL(dl_rtld_map)
 # endif
+		  );
 
 	      /* If the loader has the DF_1_NODEFLIB flag set we must not
 		 use a cache entry from any of these directories.  */
-	      if (
-# ifndef SHARED
-		  /* 'l' is always != NULL for dynamically linked objects.  */
-		  l != NULL &&
-# endif
-		  __builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0))
+	      if (__builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0))
 		{
 		  const char *dirp = system_dirs;
 		  unsigned int cnt = 0;
diff --git a/elf/dl-support.c b/elf/dl-support.c
index c0d1e4c009..e435436c31 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -91,6 +91,7 @@ static struct link_map _dl_main_map =
     .l_scope = _dl_main_map.l_scope_mem,
     .l_local_scope = { &_dl_main_map.l_searchlist },
     .l_used = 1,
+    .l_flags_1 = DF_1_NODEFLIB,
     .l_tls_offset = NO_TLS_OFFSET,
     .l_serial = 1,
   };
@@ -311,6 +312,8 @@ internal_function
 _dl_non_dynamic_init (void)
 {
   _dl_main_map.l_origin = _dl_get_origin ();
+  _dl_main_map.l_phdr = GL(dl_phdr);
+  _dl_main_map.l_phnum = GL(dl_phnum);
 
   if (HP_TIMING_AVAIL)
     HP_TIMING_NOW (_dl_cpuclock_offset);