* elf64-mips.c (mips_elf64_write_rel): Use STN_UNDEF for relocs
authorRichard Sandiford <rdsandiford@googlemail.com>
Thu, 7 Oct 2004 19:15:29 +0000 (19:15 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Thu, 7 Oct 2004 19:15:29 +0000 (19:15 +0000)
against the absolute section.
(mips_elf64_write_rela): Likewise.

bfd/ChangeLog
bfd/elf64-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/elf-rel22.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel22.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index 3dba4a3bb3ad327484f5dd76dbdddd3fe8718828..eefb123fafb9c93cc78cc84b14c3dd3b239d3be3 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-07  Richard Sandiford  <rsandifo@redhat.com>
+
+       * elf64-mips.c (mips_elf64_write_rel): Use STN_UNDEF for relocs
+       against the absolute section.
+       (mips_elf64_write_rela): Likewise.
+
 2004-10-07  Jan Beulich <jbeulich@novell.com>
 
        * elf.c (elf_find_function): Don't generally check for matching
index ac9f96f97b345108d0e929b91ee030acb33aa4aa..dd68f708a67a40570b600f64d0deb957f0bc67c7 100644 (file)
@@ -2352,6 +2352,8 @@ mips_elf64_write_rel (bfd *abfd, asection *sec,
       sym = *ptr->sym_ptr_ptr;
       if (sym == last_sym)
        n = last_sym_idx;
+      else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+       n = STN_UNDEF;
       else
        {
          last_sym = sym;
@@ -2448,6 +2450,8 @@ mips_elf64_write_rela (bfd *abfd, asection *sec,
       sym = *ptr->sym_ptr_ptr;
       if (sym == last_sym)
        n = last_sym_idx;
+      else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+       n = STN_UNDEF;
       else
        {
          last_sym = sym;
index 647a124bca3b43b5e06f2f60a702654ec2a142f1..b15a824de7d8d7d3bb2c2f1937d2041b4d49fa17 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-07  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gas/mips/elf-rel22.[sd]: New test.
+       * gas/mips/mips.exp: Run it.
+
 2004-10-07  Richard Sandiford  <rsandifo@redhat.com>
 
        * gas/mips/elf-rel21.[sd]: New test.
diff --git a/gas/testsuite/gas/mips/elf-rel22.d b/gas/testsuite/gas/mips/elf-rel22.d
new file mode 100644 (file)
index 0000000..14ab1a8
--- /dev/null
@@ -0,0 +1,9 @@
+#as: -march=mips3 -mabi=64
+#readelf: --relocs
+#name: MIPS ELF reloc 22
+
+Relocation section '\.rela\.text' .*:
+.*
+.* R_MIPS_LO16 * 0+04
+ * Type2: R_MIPS_SUB *
+ * Type3: R_MIPS_LO16 *
diff --git a/gas/testsuite/gas/mips/elf-rel22.s b/gas/testsuite/gas/mips/elf-rel22.s
new file mode 100644 (file)
index 0000000..82a1cac
--- /dev/null
@@ -0,0 +1,4 @@
+       lui     $4,%lo(%neg(%lo(bar-foo)))
+foo:
+       nop
+bar:
index ad3c83c7ab3016dbc22e4f84e0f4a8b02bf29ef3..6818417bc204e2488fa9e392e8fd4a345f5e8356 100644 (file)
@@ -664,6 +664,7 @@ if { [istarget mips*-*-*] } then {
        run_dump_test "elf-rel20"
        if $has_newabi {
            run_dump_test "elf-rel21"
+           run_dump_test "elf-rel22"
        }
 
        if { !$no_mips16 } {