The PT_DYNAMIC segment was being hard coded to have read, write, and
authorJack Carter <jcarter@mips.com>
Wed, 19 Feb 2014 00:23:48 +0000 (16:23 -0800)
committerJack Carter <jcarter@mips.com>
Wed, 19 Feb 2014 00:23:48 +0000 (16:23 -0800)
execute permission regardless of the underlying PT_LOAD segment permissions.
Deleting this code allows the default linker behavior which is to set the
dynamic segment to the same permissions as the sections that make it up.

This change alters one existing test case to check the segment flags for
PT_DYNAMIC.

bfd/ChangeLog
        * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of
        PT_DYNAMIC segment flags.

ld/testsuite/ChangeLog
* ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.

bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.sd

index eaf7d327b6309cb10593a666b2d3211cb10e5487..88e042e5cab40ad280eda51f90e77a5fd8476538 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-18  Jack Carter  <jack.carter@imgtec.com>
+
+        * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of
+        PT_DYNAMIC segment flags.
+
 2014-02-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        PR binutils/16595
index f51845b7b5e5dbea21cc55496eef509e36cf06f3..9011b6de47864ac33b7afe969f3e34abced6f94e 100644 (file)
@@ -11919,18 +11919,6 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
        if ((*pm)->p_type == PT_DYNAMIC)
          break;
       m = *pm;
-      if (m != NULL && IRIX_COMPAT (abfd) == ict_none)
-       {
-         /* For a normal mips executable the permissions for the PT_DYNAMIC
-            segment are read, write and execute. We do that here since
-            the code in elf.c sets only the read permission. This matters
-            sometimes for the dynamic linker.  */
-         if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
-           {
-             m->p_flags = PF_R | PF_W | PF_X;
-             m->p_flags_valid = 1;
-           }
-       }
       /* GNU/Linux binaries do not need the extended PT_DYNAMIC section.
         glibc's dynamic linker has traditionally derived the number of
         tags from the p_filesz field, and sometimes allocates stack
index 337cbf00c2ff377ce96066d8ebcaeebe67f25a95..4b37b0d1ad0deb2292e8fe50bd9461bb9a18e140 100644 (file)
@@ -1,3 +1,7 @@
+2014-02-18  Jack Carter  <jack.carter@imgtec.com>
+
+       * ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.
+
 2014-02-16  Thomas Schwinge  <thomas@codesourcery.com>
 
        * ld-elfweak/elfweak.exp (setup_xfail_gnu_hurd): Remove function
index 58b50c309742160764a7da5e400e22968b1367a0..b178bdf50ae88ad9b5dcfd37813f3f3e99611481 100644 (file)
@@ -8,7 +8,7 @@ Program Headers:
  * REGINFO * [^ ]+ * 0x0+00000 * 0x0+00000 [^ ]+ * [^ ]+ * R * 0x.*
  * LOAD * [^ ]+ * 0x0+00000 * 0x0+00000 [^ ]+ * [^ ]+ * R E * 0x.*
  * LOAD * [^ ]+ * 0x0+10000 * 0x0+10000 [^ ]+ * [^ ]+ * RW  * 0x.*
- * DYNAMIC * [^ ]+ * 0x0+00400 * 0x0+00400 .*
+ * DYNAMIC * [^ ]+ * 0x0+00400 * 0x0+00400 [^ ]+ * [^ ]+ * R  * 0x.*
  * NULL * .*
 
  *Section to Segment mapping: