bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Thu, 12 Apr 2007 19:26:09 +0000 (19:26 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Thu, 12 Apr 2007 19:26:09 +0000 (19:26 +0000)
* elfxx-mips.c (mips_elf_calculate_relocation): Set DT_TEXTREL
when creating a __GOTT_BASE__ or __GOTT_INDEX__ relocation
in a read-only section.
(_bfd_mips_elf_check_relocs): Likewise.

ld/testsuite/
* ld-mips-elf/vxworks1-lib.td: New test.
* ld-mips-elf/mips-elf.exp: Run it.

bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/mips-elf.exp
ld/testsuite/ld-mips-elf/vxworks1-lib.td [new file with mode: 0644]

index d475ebf92d29340685149aa1d81d313fe99911d9..962a288ac6eba6babb08cdec68c19b0aa98d2201 100644 (file)
@@ -1,3 +1,10 @@
+2007-04-12  Richard Sandiford  <richard@codesourcery.com>
+
+       * elfxx-mips.c (mips_elf_calculate_relocation): Set DT_TEXTREL
+       when creating a __GOTT_BASE__ or __GOTT_INDEX__ relocation
+       in a read-only section.
+       (_bfd_mips_elf_check_relocs): Likewise.
+
 2007-04-12  Bob Wilson  <bob.wilson@acm.org>
 
        * elf32-xtensa.c (xtensa_is_insntable_section): New.
index ec651417ad6b59c3285b24c1586046a7d353607f..5c782de5d5b2b5147f871e00d304e5f26a1a266f 100644 (file)
@@ -4275,6 +4275,13 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
       outrel.r_info = ELF32_R_INFO (h->root.dynindx, r_type);
       outrel.r_addend = addend;
       bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+
+      /* If we've written this relocation for a readonly section,
+        we need to set DF_TEXTREL again, so that we do not delete the
+        DT_TEXTREL tag.  */
+      if (MIPS_ELF_READONLY_SECTION (input_section))
+       info->flags |= DF_TEXTREL;
+
       *valuep = 0;
       return bfd_reloc_ok;
     }
@@ -6493,6 +6500,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
                    return FALSE;
                }
              mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
+             if (MIPS_ELF_READONLY_SECTION (sec))
+               /* We tell the dynamic linker that there are
+                  relocations against the text segment.  */
+               info->flags |= DF_TEXTREL;
            }
        }
       else if (r_type == R_MIPS_CALL_LO16
index bea757ea21c02e05783e7afbfa654b9268cf266d..da49ab720053510e847338ff726f2c12a9bd5263 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-12  Richard Sandiford  <richard@codesourcery.com>
+
+       * ld-mips-elf/vxworks1-lib.td: New test.
+       * ld-mips-elf/mips-elf.exp: Run it.
+
 2007-04-05  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/4304
index 5bb5c38f88bf5d5e3462561284c25d2c2e8f0a2c..d022c8ddec9ebe07c785d53ec24b50cdc3bf6eea 100644 (file)
@@ -21,7 +21,7 @@ if {[istarget "mips*-*-vxworks"]} {
        {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
         "-mips2" {vxworks1-lib.s}
         {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
-         {readelf --symbols vxworks1-lib.nd}}
+         {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
         "libvxworks1.so"}
        {"VxWorks executable test 1 (dynamic)" \
         "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
diff --git a/ld/testsuite/ld-mips-elf/vxworks1-lib.td b/ld/testsuite/ld-mips-elf/vxworks1-lib.td
new file mode 100644 (file)
index 0000000..9f223e3
--- /dev/null
@@ -0,0 +1,3 @@
+#...
+ 0x0+16 \(TEXTREL\) +0x0
+#pass