From 99022dfb1d4b1de6f394026ffd5b738b522aa9f6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 7 Oct 2004 19:15:29 +0000 Subject: [PATCH] * elf64-mips.c (mips_elf64_write_rel): Use STN_UNDEF for relocs against the absolute section. (mips_elf64_write_rela): Likewise. --- bfd/ChangeLog | 6 ++++++ bfd/elf64-mips.c | 4 ++++ gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/mips/elf-rel22.d | 9 +++++++++ gas/testsuite/gas/mips/elf-rel22.s | 4 ++++ gas/testsuite/gas/mips/mips.exp | 1 + 6 files changed, 29 insertions(+) create mode 100644 gas/testsuite/gas/mips/elf-rel22.d create mode 100644 gas/testsuite/gas/mips/elf-rel22.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3dba4a3bb3a..eefb123fafb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2004-10-07 Richard Sandiford + + * 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 * elf.c (elf_find_function): Don't generally check for matching diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index ac9f96f97b3..dd68f708a67 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -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; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 647a124bca3..b15a824de7d 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-10-07 Richard Sandiford + + * gas/mips/elf-rel22.[sd]: New test. + * gas/mips/mips.exp: Run it. + 2004-10-07 Richard Sandiford * 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 index 00000000000..14ab1a8b5bd --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel22.d @@ -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 index 00000000000..82a1cac04ac --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel22.s @@ -0,0 +1,4 @@ + lui $4,%lo(%neg(%lo(bar-foo))) +foo: + nop +bar: diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index ad3c83c7ab3..6818417bc20 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -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 } { -- 2.30.2