aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf/mips-elf.exp
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-07-01 00:42:19 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2017-07-01 00:42:19 +0100
commit9f00292e69635d48623372c7a3e390dc5d159a8f (patch)
treed625f865ccb7101eea8a9e3b46f4deb0c4c55d93 /ld/testsuite/ld-mips-elf/mips-elf.exp
parent32f76c677333510350f21a40db062a8d17995c53 (diff)
downloadgdb-9f00292e69635d48623372c7a3e390dc5d159a8f.zip
gdb-9f00292e69635d48623372c7a3e390dc5d159a8f.tar.gz
gdb-9f00292e69635d48623372c7a3e390dc5d159a8f.tar.bz2
MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation
Use frag symbols with a non-zero offset directly in `fix_new_exp' calls made in PIC branch relaxation. There is no need here to make a helper symbol to hold the result of a `symbol+offset' calculation requested as only branches to local symbols are relaxed and in this case the LO16 part of the PIC address load sequence will have the offset accounted for in calculation against the local GOT entry retrieved as the GOT16 high part. Consequently actual code produed is identical whether a helper symbol is used or the original `symbol+offset' expression used directly. Verify that this is indeed the case with GAS and LD tests. gas/ * config/tc-mips.c (md_convert_frag): Don't make a helper expression symbol for `fix_new_exp' called with a non-zero offset. * testsuite/gas/mips/relax-offset.d: New test. * testsuite/gas/mips/mips1@relax-offset.d: New test. * testsuite/gas/mips/r3000@relax-offset.d: New test. * testsuite/gas/mips/r3900@relax-offset.d: New test. * testsuite/gas/mips/micromips@relax-offset.d: New test. * testsuite/gas/mips/relax-offset.l: New stderr output. * testsuite/gas/mips/relax-offset.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/relax-offset.dd: New test. * testsuite/ld-mips-elf/relax-offset.gd: New test. * testsuite/ld-mips-elf/relax-offset-umips.dd: New test. * testsuite/ld-mips-elf/relax-offset-umips.gd: New test. * testsuite/ld-mips-elf/relax-offset.ld: New test linker script. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. (prune_warnings): New temporary procedure.
Diffstat (limited to 'ld/testsuite/ld-mips-elf/mips-elf.exp')
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp34
1 files changed, 34 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 66b2ae4..4360b83 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -1179,3 +1179,37 @@ run_ld_link_tests [list \
# Check that the ISA level is consistently II for the LSI 4010.
run_dump_test "lsi-4010-isa" [list [list ld $abi_ldflags(o32)]]
+
+# PIC branch relaxation with offset tests. We need to use our version
+# of `prune_warnings' to get rid of GAS branch relaxation noise.
+rename prune_warnings mips_old_prune_warnings
+proc prune_warnings { msg } {
+ set msg1 "Assembler messages:"
+ set msg2 "Warning: relaxed out-of-range branch into a jump"
+ set msgx "(?:$msg1|$msg2)"
+ regsub -all "(^|\[\n\r\]*)\[^\n\r\]*: $msgx\[\n\r\]*" $msg "\\1" msg
+ return [mips_old_prune_warnings $msg]
+}
+run_ld_link_tests [list \
+ [list \
+ "MIPS link PIC branch relaxation with offset" \
+ "$abi_ldflags(o32) -shared -T relax-offset.ld" "" \
+ "$abi_asflags(o32) -relax-branch -mips2" \
+ {../../../gas/testsuite/gas/mips/relax-offset.s} \
+ {{objdump \
+ {-d --prefix-addresses --show-raw-insn} \
+ relax-offset.dd} \
+ {readelf -A relax-offset.gd}} \
+ "relax-offset"] \
+ [list \
+ "microMIPS link PIC branch relaxation with offset" \
+ "$abi_ldflags(o32) -shared -T relax-offset.ld" "" \
+ "$abi_asflags(o32) -relax-branch -mmicromips" \
+ {../../../gas/testsuite/gas/mips/relax-offset.s} \
+ {{objdump \
+ {-d --prefix-addresses --show-raw-insn} \
+ relax-offset-umips.dd} \
+ {readelf -A relax-offset-umips.gd}} \
+ "relax-offset-umips"]]
+rename prune_warnings ""
+rename mips_old_prune_warnings prune_warnings