Set interpreter in x86 create_dynamic_sections
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 29 Apr 2016 15:27:13 +0000 (08:27 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 29 Apr 2016 15:27:29 +0000 (08:27 -0700)
Set interpreter in x86 create_dynamic_sections to make this information
available to x86 check_relocs.

* elf32-i386.c (elf_i386_size_dynamic_sections): Move interp
setting to ...
(elf_i386_create_dynamic_sections): Here.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Move
interp setting to ...
(elf_x86_64_create_dynamic_sections): Here.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index ae512f71e6103cb793d8acc6a5b30577b737a1e1..394e83c96174d68c24a70c27314646cf332d27f5 100644 (file)
@@ -1,3 +1,12 @@
+2016-04-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-i386.c (elf_i386_size_dynamic_sections): Move interp
+       setting to ...
+       (elf_i386_create_dynamic_sections): Here.
+       * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Move
+       interp setting to ...
+       (elf_x86_64_create_dynamic_sections): Here.
+
 2016-04-29  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Take GOT_RELOC
index 38b1d3b63ad9e6b9f5efc2bd79ddeee6981406b7..c45697c0db2069438fdf0f7e5296d69f1afb461e 100644 (file)
@@ -1066,6 +1066,17 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
   if (htab == NULL)
     return FALSE;
 
+  /* Set the contents of the .interp section to the interpreter.  */
+  if (bfd_link_executable (info) && !info->nointerp)
+    {
+      asection *s = bfd_get_linker_section (dynobj, ".interp");
+      if (s == NULL)
+       abort ();
+      s->size = sizeof ELF_DYNAMIC_INTERPRETER;
+      s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+      htab->interp = s;
+    }
+
   htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
   if (!htab->sdynbss)
     abort ();
@@ -3089,20 +3100,6 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
   if (dynobj == NULL)
     abort ();
 
-  if (htab->elf.dynamic_sections_created)
-    {
-      /* Set the contents of the .interp section to the interpreter.  */
-      if (bfd_link_executable (info) && !info->nointerp)
-       {
-         s = bfd_get_linker_section (dynobj, ".interp");
-         if (s == NULL)
-           abort ();
-         s->size = sizeof ELF_DYNAMIC_INTERPRETER;
-         s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
-         htab->interp = s;
-       }
-    }
-
   /* Set up .got offsets for local syms, and space for local dynamic
      relocs.  */
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
index 3775853d43fb8fd10874ade5d5685fda7055ed12..364379aa701b89f9473934e1d16c3851794267b3 100644 (file)
@@ -1109,6 +1109,17 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj,
   if (htab == NULL)
     return FALSE;
 
+  /* Set the contents of the .interp section to the interpreter.  */
+  if (bfd_link_executable (info) && !info->nointerp)
+    {
+      asection *s = bfd_get_linker_section (dynobj, ".interp");
+      if (s == NULL)
+       abort ();
+      s->size = htab->dynamic_interpreter_size;
+      s->contents = (unsigned char *) htab->dynamic_interpreter;
+      htab->interp = s;
+    }
+
   htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
   if (!htab->sdynbss)
     abort ();
@@ -3446,20 +3457,6 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
   if (dynobj == NULL)
     abort ();
 
-  if (htab->elf.dynamic_sections_created)
-    {
-      /* Set the contents of the .interp section to the interpreter.  */
-      if (bfd_link_executable (info) && !info->nointerp)
-       {
-         s = bfd_get_linker_section (dynobj, ".interp");
-         if (s == NULL)
-           abort ();
-         s->size = htab->dynamic_interpreter_size;
-         s->contents = (unsigned char *) htab->dynamic_interpreter;
-         htab->interp = s;
-       }
-    }
-
   /* Set up .got offsets for local syms, and space for local dynamic
      relocs.  */
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
This page took 0.030652 seconds and 4 git commands to generate.