about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-21 22:34:38 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-21 22:34:38 +0000
commit445888be74927684421b53d66981309d676bdcda (patch)
tree50a456e6904e224aea2b3b452de1b80771474cf6 /elf
parent4ba3c7461c3125ed2df94f1c35f1e1f67e68315a (diff)
downloadglibc-445888be74927684421b53d66981309d676bdcda.tar.gz
glibc-445888be74927684421b53d66981309d676bdcda.tar.xz
glibc-445888be74927684421b53d66981309d676bdcda.zip
(elf_get_dynamic_info): Recognize DF_1_NOW. In ld.so, neither DT_FLAGS nor DT_FLAGS_1 must be used.
Diffstat (limited to 'elf')
-rw-r--r--elf/dynamic-link.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 0179de3273..199e1bac5c 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -1,5 +1,5 @@
 /* Inline functions for dynamic linking.
-   Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004 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
@@ -158,31 +158,35 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
   if (info[DT_REL] != NULL)
     assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel)));
 #endif
+#ifdef RTLD_BOOTSTRAP
+  /* Flags must not be set for ld.so.  */
+  assert (info[DT_FLAGS] == NULL);
+  assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL);
+  /* The dynamic linker should have none of these set.  */
+  assert (info[DT_RUNPATH] == NULL);
+  assert (info[DT_RPATH] == NULL);
+#else
   if (info[DT_FLAGS] != NULL)
     {
       /* Flags are used.  Translate to the old form where available.
 	 Since these l_info entries are only tested for NULL pointers it
 	 is ok if they point to the DT_FLAGS entry.  */
       l->l_flags = info[DT_FLAGS]->d_un.d_val;
-#ifdef RTLD_BOOTSTRAP
-      /* These three flags must not be set for ld.so.  */
-      assert ((l->l_flags & (DF_SYMBOLIC | DF_TEXTREL | DF_BIND_NOW)) == 0);
-#else
+
       if (l->l_flags & DF_SYMBOLIC)
 	info[DT_SYMBOLIC] = info[DT_FLAGS];
       if (l->l_flags & DF_TEXTREL)
 	info[DT_TEXTREL] = info[DT_FLAGS];
       if (l->l_flags & DF_BIND_NOW)
 	info[DT_BIND_NOW] = info[DT_FLAGS];
-#endif
     }
   if (info[VERSYMIDX (DT_FLAGS_1)] != NULL)
-    l->l_flags_1 = info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val;
-#ifdef RTLD_BOOTSTRAP
-  /* The dynamic linker should have none of these set.  */
-  assert (info[DT_RUNPATH] == NULL);
-  assert (info[DT_RPATH] == NULL);
-#else
+    {
+      l->l_flags_1 = info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val;
+
+      if (l->l_flags_1 & DF_1_NOW)
+	info[DT_BIND_NOW] = info[VERSYMIDX (DT_FLAGS_1)];
+    }
   if (info[DT_RUNPATH] != NULL)
     /* If both RUNPATH and RPATH are given, the latter is ignored.  */
     info[DT_RPATH] = NULL;