From 631cb423b20271e4762464b851a0999babf55407 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 21 Oct 2002 14:59:30 +0000 Subject: [PATCH] * config/tc-mips.c (mips_need_elf_addend_fixup): Return true for relocs against symbols in a merged section. testsuite/ * gas/mips/elf-rel7.[sd]: New test. * gas/mips/mips.exp: Run it. --- gas/ChangeLog | 5 +++++ gas/config/tc-mips.c | 2 +- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/mips/elf-rel7.d | 31 +++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/elf-rel7.s | 12 ++++++++++++ gas/testsuite/gas/mips/mips.exp | 1 + 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/mips/elf-rel7.d create mode 100644 gas/testsuite/gas/mips/elf-rel7.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 1c9ee5bab1c..adbcfa7f132 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2002-10-21 Richard Sandiford + + * config/tc-mips.c (mips_need_elf_addend_fixup): Return true + for relocs against symbols in a merged section. + 2002-10-18 Alexandre Oliva * config/tc-mips.c (md_begin): Add $fcc registers to the symbol diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index de49657b3f6..329d1a495f0 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -10981,7 +10981,7 @@ mips_need_elf_addend_fixup (fixP) if (symbol_used_in_reloc_p (fixP->fx_addsy) && (((bfd_get_section_flags (stdoutput, S_GET_SEGMENT (fixP->fx_addsy)) - & SEC_LINK_ONCE) != 0) + & (SEC_LINK_ONCE | SEC_MERGE)) != 0) || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), ".gnu.linkonce", sizeof (".gnu.linkonce") - 1))) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 17aa39b214c..d6ec0cc4706 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-10-21 Richard Sandiford + + * gas/mips/elf-rel7.[sd]: New test. + * gas/mips/mips.exp: Run it. + 2002-10-12 Alexandre Oliva * gas/mips/mips.exp: Don't xfail relax. diff --git a/gas/testsuite/gas/mips/elf-rel7.d b/gas/testsuite/gas/mips/elf-rel7.d new file mode 100644 index 00000000000..d72ae15daaf --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel7.d @@ -0,0 +1,31 @@ +#objdump: -dr --prefix-addresses +#name: MIPS ELF reloc 7 + +.*: +file format elf.*mips.* + +Disassembly of section \.text: +0+00 <.*> lui a0,0x0 + 0: R_MIPS_HI16 .barsec +0+04 <.*> lw a0,8\(a0\) + 4: R_MIPS_LO16 .barsec +0+08 <.*> lui a0,0x0 + 8: R_MIPS_HI16 bar +0+0c <.*> lw a0,4\(a0\) + c: R_MIPS_LO16 bar +0+10 <.*> lui a0,0x0 + 10: R_MIPS_HI16 bar +0+14 <.*> lw a0,8\(a0\) + 14: R_MIPS_LO16 bar +0+18 <.*> lui a0,0x0 + 18: R_MIPS_HI16 frob +0+1c <.*> lw a0,0\(a0\) + 1c: R_MIPS_LO16 frob +0+20 <.*> lui a0,0x0 + 20: R_MIPS_HI16 frob +0+24 <.*> lw a0,4\(a0\) + 24: R_MIPS_LO16 frob +0+28 <.*> lui a0,0x0 + 28: R_MIPS_HI16 frob +0+2c <.*> lw a0,16\(a0\) + 2c: R_MIPS_LO16 frob +#pass diff --git a/gas/testsuite/gas/mips/elf-rel7.s b/gas/testsuite/gas/mips/elf-rel7.s new file mode 100644 index 00000000000..15665eed5fe --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel7.s @@ -0,0 +1,12 @@ + .global frob + .section .barsec,"aM",@progbits,8 + .word 0,1 +bar: .word 2,3 +frob: .word 4,5 + .text +foo: lw $4,bar + lw $4,bar+4 + lw $4,bar+8 + lw $4,frob + lw $4,frob+4 + lw $4,frob+16 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index eac3c31d8b4..2800db198b1 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -220,6 +220,7 @@ if { [istarget mips*-*-*] } then { } run_dump_test "elf-rel5" run_dump_test "elf-rel6" + run_dump_test "elf-rel7" run_dump_test "${tmips}${el}empic" run_dump_test "empic2" run_dump_test "empic3_e" -- 2.30.2