Has the dynamic section to be read-write?

Andreas Jaeger aj@suse.de
Wed Nov 24 06:38:00 GMT 1999


Here's a suggested patch for elf/link.h to implement the changed data
structure.  Is this ok?  Please send me your critizisms so that I can
change this and finally send a patch for the complete dynamic linker.

Andreas

============================================================
Index: elf/link.h
--- elf/link.h	1999/09/13 09:05:38	1.69
+++ elf/link.h	1999/11/24 14:12:17
@@ -110,6 +110,28 @@
    This data structure might change in future, if necessary.  User-level
    programs must avoid defining objects of this type.  */
 
+/* Copy of dynamic section entry for use in dynamic linker.  */
+
+typedef struct
+{
+  int valid;				/* Entry is valid.  */
+  union
+    {
+      Elf32_Word d_val;			/* Integer value */
+      Elf32_Addr d_ptr;			/* Address value */
+    } d_un;
+} Elf32_Dyn_rtld;
+
+typedef struct
+{
+  int valid;				/* Entry is valid.  */
+  union
+    {
+      Elf64_Xword d_val;		/* Integer value */
+      Elf64_Addr d_ptr;			/* Address value */
+    } d_un;
+} Elf64_Dyn_rtld;
+
 struct link_map
   {
     /* These first few members are part of the protocol with the debugger.
@@ -133,7 +155,7 @@
         DT_NUM+DT_PROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM)
        are indexed by DT_EXTRATAGIDX(tagvalue) (see <elf.h>).  */
 
-    ElfW(Dyn) *l_info[DT_NUM + DT_PROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM];
+    ElfW(Dyn_rtld) l_info[DT_NUM + DT_PROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM];
     const ElfW(Phdr) *l_phdr;	/* Pointer to program header table in core.  */
     ElfW(Addr) l_entry;		/* Entry point location.  */
     ElfW(Half) l_phnum;		/* Number of program header entries.  */

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de


More information about the Libc-alpha mailing list