From 30cfc97a80d6823ca7a7c860d5daa682d456df43 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Tue, 6 Jul 2010 00:12:42 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (mips_frob_file): Use symbol_same_p to match symbols. gas/testsuite/ * gas/mips/elf-rel27.d: New test for HI16/LO16 relocation pairing. * gas/mips/elf-rel27.s: Source for the new test. * gas/mips/mips.exp: Create "mips16" architecture. Adjust conditions involving negated properties throughout to require "mips1" as appropriate. Run the new test. (mips_arch_destroy): New procedure. --- gas/ChangeLog | 5 +++++ gas/config/tc-mips.c | 2 +- gas/testsuite/ChangeLog | 10 ++++++++++ gas/testsuite/gas/mips/elf-rel27.d | 10 ++++++++++ gas/testsuite/gas/mips/elf-rel27.s | 9 +++++++++ gas/testsuite/gas/mips/mips.exp | 33 ++++++++++++++++++++++++++++----- 6 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 gas/testsuite/gas/mips/elf-rel27.d create mode 100644 gas/testsuite/gas/mips/elf-rel27.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 1ce6dbb..1a22a35 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ 2010-07-06 Maciej W. Rozycki + * config/tc-mips.c (mips_frob_file): Use symbol_same_p to match + symbols. + +2010-07-06 Maciej W. Rozycki + * config/tc-mips.c (nops_for_insn_or_target): Replace MIPS16_INSN_BRANCH with MIPS16_INSN_UNCOND_BRANCH and MIPS16_INSN_COND_BRANCH. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 4025f12..65ff6d4 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -12234,7 +12234,7 @@ mips_frob_file (void) hi_pos = pos; if ((*pos)->fx_r_type == looking_for_rtype - && (*pos)->fx_addsy == l->fixp->fx_addsy + && symbol_same_p ((*pos)->fx_addsy, l->fixp->fx_addsy) && (*pos)->fx_offset >= l->fixp->fx_offset && (lo_pos == NULL || (*pos)->fx_offset < (*lo_pos)->fx_offset diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 046e106..2d89bb8 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-07-06 Maciej W. Rozycki + + * gas/mips/elf-rel27.d: New test for HI16/LO16 relocation + pairing. + * gas/mips/elf-rel27.s: Source for the new test. + * gas/mips/mips.exp: Create "mips16" architecture. Adjust + conditions involving negated properties throughout to require + "mips1" as appropriate. Run the new test. + (mips_arch_destroy): New procedure. + 2010-07-05 Maciej W. Rozycki * gas/mips/mips.exp (run_dump_test_arch): Check for the presence diff --git a/gas/testsuite/gas/mips/elf-rel27.d b/gas/testsuite/gas/mips/elf-rel27.d new file mode 100644 index 0000000..be81e4e --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel27.d @@ -0,0 +1,10 @@ +#PROG: readelf +#readelf: -Wr +#name: MIPS ELF reloc 27 +#as: -32 + +Relocation section '\.rel\.text' at offset .* contains [34] entries: + *Offset * Info * Type * Sym\. Value * Symbol's Name +[0-9a-f]+ * [0-9a-f]+ R_(MIPS|MIPS16)_HI16 * [0-9a-f]+ * (\.text|\.L0) +[0-9a-f]+ * [0-9a-f]+ R_(MIPS|MIPS16)_HI16 * [0-9a-f]+ * (\.text|\.L0) +[0-9a-f]+ * [0-9a-f]+ R_(MIPS|MIPS16)_LO16 * [0-9a-f]+ * (\.text|\.L0) diff --git a/gas/testsuite/gas/mips/elf-rel27.s b/gas/testsuite/gas/mips/elf-rel27.s new file mode 100644 index 0000000..db05e93 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel27.s @@ -0,0 +1,9 @@ + .text +foo: + li $5, %hi(.L0) + sll $5, 16 + addiu $5, %lo(.L0) +.L0: + b .L0 + li $5, %hi(.L0) + sll $5, 16 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 842cfbf..ed721ad 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -146,6 +146,19 @@ proc mips_arch_create {arch gprsize extends props as_flags objdump_flags } } +# mips_arch_destroy ARCH +# +# The opposite of the above. This function removes an entry from +# the architecture data array, for the architecture or CPU named ARCH. + +proc mips_arch_destroy {arch} { + global mips_arches + + if { [info exists mips_arches($arch)] } { + unset mips_arches($arch) + } +} + # mips_arch_list_all # # This function returns the list of all names of entries in the @@ -354,6 +367,8 @@ mips_arch_create mips64r2 64 mips64 { mips32r2 ror } \ { -march=mips64r2 -mtune=mips64r2 } \ { -mmips:isa64r2 } \ { mipsisa64r2-*-* mipsisa64r2el-*-* } +mips_arch_create mips16 32 {} {} \ + { -march=mips1 -mips16 } { -mmips:16 } mips_arch_create r3000 32 mips1 {} \ { -march=r3000 -mtune=r3000 } { -mmips:3000 } mips_arch_create r3900 32 mips1 { gpr_ilocks } \ @@ -403,6 +418,9 @@ if { [istarget mips*-*-vxworks*] } { if { $ecoff } { set no_mips16 1 } + if { $no_mips16 } { + mips_arch_destroy mips16 + } run_dump_test_arches "abs" [mips_arch_list_matching mips1] run_dump_test_arches "add" [mips_arch_list_matching mips1] @@ -456,10 +474,11 @@ if { [istarget mips*-*-vxworks*] } { if !$aout { # XXX FIXME: Has mips2 and later insns with mips1 disassemblies. # (Should split and then use appropriate arch lists.) - run_dump_test_arches "lb" [mips_arch_list_matching !mips2] + run_dump_test_arches "lb" [mips_arch_list_matching mips1 !mips2] } if $elf { - run_dump_test_arches "lb-svr4pic" [mips_arch_list_matching !gpr_ilocks] + run_dump_test_arches "lb-svr4pic" \ + [mips_arch_list_matching mips1 !gpr_ilocks] run_dump_test_arches "lb-svr4pic-ilocks" [mips_arch_list_matching gpr_ilocks] } if $elf { @@ -496,7 +515,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test_arches "mips5" [mips_arch_list_matching mips5] run_dump_test "mul" - run_dump_test_arches "rol" [mips_arch_list_matching !ror] + run_dump_test_arches "rol" [mips_arch_list_matching mips1 !ror] run_dump_test_arches "rol-hw" [mips_arch_list_matching ror] run_dump_test_arches "rol64" [mips_arch_list_matching gpr64 !ror] @@ -516,9 +535,11 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "usw" run_dump_test "usd" } - run_dump_test_arches "ulw2-eb" [mips_arch_list_matching !gpr_ilocks] + run_dump_test_arches "ulw2-eb" \ + [mips_arch_list_matching mips1 !gpr_ilocks] run_dump_test_arches "ulw2-eb-ilocks" [mips_arch_list_matching gpr_ilocks] - run_dump_test_arches "ulw2-el" [mips_arch_list_matching !gpr_ilocks] + run_dump_test_arches "ulw2-el" \ + [mips_arch_list_matching mips1 !gpr_ilocks] run_dump_test_arches "ulw2-el-ilocks" [mips_arch_list_matching gpr_ilocks] run_dump_test_arches "uld2-eb" [mips_arch_list_matching mips3] @@ -705,6 +726,8 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "elf-rel25a" run_dump_test "elf-rel26" + run_dump_test_arches "elf-rel27" [mips_arch_list_all] + if { !$no_mips16 } { run_dump_test "${tmips}mips${el}16-e" run_dump_test "${tmips}mips${el}16-f" -- 2.7.4