aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2010-07-24 01:51:53 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2010-07-24 01:51:53 +0000
commitd3fca0b5d450cea85fba81558f8faa8486d99e69 (patch)
tree10eb4d22d6412769a43abd06c8331e4b25e8d4c2 /gas
parent4d2ad3b06d0951856569e528340b4bb960bbdbca (diff)
downloadbinutils-d3fca0b5d450cea85fba81558f8faa8486d99e69.zip
binutils-d3fca0b5d450cea85fba81558f8faa8486d99e69.tar.gz
binutils-d3fca0b5d450cea85fba81558f8faa8486d99e69.tar.bz2
gas/
* config/tc-mips.c (macro)[M_JAL_1, M_JAL_2]: Handle the JALR delay slot in the noreorder mode with the o32 ABI. gas/testsuite/ * gas/mips/jal-svr4pic-noreorder.d: New test case. * gas/mips/mips1@jal-svr4pic-noreorder.d: New test subarchitecture. * gas/mips/r3000@jal-svr4pic-noreorder.d: Likewise. * gas/mips/jal-svr4pic-noreorder.s: Source for the new test case. * gas/mips/mips.exp: Run the new test case.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-mips.c2
-rw-r--r--gas/testsuite/ChangeLog10
-rw-r--r--gas/testsuite/gas/mips/jal-svr4pic-noreorder.d45
-rw-r--r--gas/testsuite/gas/mips/jal-svr4pic-noreorder.s25
-rw-r--r--gas/testsuite/gas/mips/mips.exp2
-rw-r--r--gas/testsuite/gas/mips/mips1@jal-svr4pic-noreorder.d48
-rw-r--r--gas/testsuite/gas/mips/r3000@jal-svr4pic-noreorder.d5
8 files changed, 142 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5ad0269..09ee0a2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-24 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config/tc-mips.c (macro)[M_JAL_1, M_JAL_2]: Handle the JALR
+ delay slot in the noreorder mode with the o32 ABI.
+
2010-07-23 Naveen.H.S <naveen.S@kpitcummins.com>
Ina Pandit <ina.pandit@kpitcummins.com>
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 21aedd9..103ab6f 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -6219,6 +6219,8 @@ macro (struct mips_cl_insn *ip)
/* Quiet this warning. */
mips_cprestore_valid = 1;
}
+ if (mips_opts.noreorder)
+ macro_build (NULL, "nop", "");
expr1.X_add_number = mips_cprestore_offset;
macro_build_ldst_constoffset (&expr1, ADDRESS_LOAD_INSN,
mips_gp_register,
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index a71657a..aa1b0a4 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,15 @@
2010-07-24 Maciej W. Rozycki <macro@codesourcery.com>
+ * gas/mips/jal-svr4pic-noreorder.d: New test case.
+ * gas/mips/mips1@jal-svr4pic-noreorder.d: New test
+ subarchitecture.
+ * gas/mips/r3000@jal-svr4pic-noreorder.d: Likewise.
+ * gas/mips/jal-svr4pic-noreorder.s: Source for the new test
+ case.
+ * gas/mips/mips.exp: Run the new test case.
+
+2010-07-24 Maciej W. Rozycki <macro@codesourcery.com>
+
* gas/mips/jal-svr4pic.d: Rename to...
* gas/mips/mips1@jal-svr4pic.d: ... this.
* gas/mips/r3000@jal-svr4pic.d: New test subarchitecture.
diff --git a/gas/testsuite/gas/mips/jal-svr4pic-noreorder.d b/gas/testsuite/gas/mips/jal-svr4pic-noreorder.d
new file mode 100644
index 0000000..26a4cc1
--- /dev/null
+++ b/gas/testsuite/gas/mips/jal-svr4pic-noreorder.d
@@ -0,0 +1,45 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS jal-svr4pic noreorder
+#as: -32 -KPIC
+#source: jal-svr4pic-noreorder.s
+
+# Test the jal macro with -KPIC and `.set noreorder'.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 3c1c0000 lui gp,0x0
+[ ]*0: R_MIPS_HI16 _gp_disp
+[0-9a-f]+ <[^>]*> 279c0000 addiu gp,gp,0
+[ ]*4: R_MIPS_LO16 _gp_disp
+[0-9a-f]+ <[^>]*> 0399e021 addu gp,gp,t9
+[0-9a-f]+ <[^>]*> afbc0000 sw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 03202009 jalr a0,t9
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*28: R_MIPS_GOT16 .text
+[0-9a-f]+ <[^>]*> 27390000 addiu t9,t9,0
+[ ]*2c: R_MIPS_LO16 .text
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*30: R_MIPS_JALR text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*3c: R_MIPS_CALL16 weak_text_label
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*40: R_MIPS_JALR weak_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*4c: R_MIPS_CALL16 external_text_label
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*50: R_MIPS_JALR external_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 1000ffe8 b 0+0000 <text_label>
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/jal-svr4pic-noreorder.s b/gas/testsuite/gas/mips/jal-svr4pic-noreorder.s
new file mode 100644
index 0000000..a856714
--- /dev/null
+++ b/gas/testsuite/gas/mips/jal-svr4pic-noreorder.s
@@ -0,0 +1,25 @@
+# Source file used to test the jal macro with -KPIC code.
+
+ .weak weak_text_label
+
+ .ent text_label
+text_label:
+ .frame $sp,0,$31
+ .set noreorder
+ .cpload $25
+ .cprestore 0
+ jal $25
+ jal $4,$25
+ jal text_label
+ jal weak_text_label
+ jal external_text_label
+
+# Test j as well.
+ j text_label
+ .set reorder
+ nop
+ .end text_label
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 2
+ .space 8
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index e3aade4..b5f31fe 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -465,6 +465,8 @@ if { [istarget mips*-*-vxworks*] } {
if $elf {
run_dump_test_arches "jal-svr4pic" \
[mips_arch_list_matching mips1]
+ run_dump_test_arches "jal-svr4pic-noreorder" \
+ [mips_arch_list_matching mips1]
}
if $elf { run_dump_test "jal-xgot" }
run_list_test_arches "jal-range" "-32" [mips_arch_list_matching mips1]
diff --git a/gas/testsuite/gas/mips/mips1@jal-svr4pic-noreorder.d b/gas/testsuite/gas/mips/mips1@jal-svr4pic-noreorder.d
new file mode 100644
index 0000000..4ac9467
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips1@jal-svr4pic-noreorder.d
@@ -0,0 +1,48 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS jal-svr4pic noreorder
+#as: -32 -KPIC
+#source: jal-svr4pic-noreorder.s
+
+# Test the jal macro with -KPIC and `.set noreorder' (MIPS1).
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 3c1c0000 lui gp,0x0
+[ ]*0: R_MIPS_HI16 _gp_disp
+[0-9a-f]+ <[^>]*> 279c0000 addiu gp,gp,0
+[ ]*4: R_MIPS_LO16 _gp_disp
+[0-9a-f]+ <[^>]*> 0399e021 addu gp,gp,t9
+[0-9a-f]+ <[^>]*> afbc0000 sw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 03202009 jalr a0,t9
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*28: R_MIPS_GOT16 .text
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 27390000 addiu t9,t9,0
+[ ]*30: R_MIPS_LO16 .text
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*34: R_MIPS_JALR text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*40: R_MIPS_CALL16 weak_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*48: R_MIPS_JALR weak_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 8f990000 lw t9,0\(gp\)
+[ ]*54: R_MIPS_CALL16 external_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 0320f809 jalr t9
+[ ]*5c: R_MIPS_JALR external_text_label
+[0-9a-f]+ <[^>]*> 00000000 nop
+[0-9a-f]+ <[^>]*> 8fbc0000 lw gp,0\(sp\)
+[0-9a-f]+ <[^>]*> 1000ffe5 b 0+0000 <text_label>
+[0-9a-f]+ <[^>]*> 00000000 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/r3000@jal-svr4pic-noreorder.d b/gas/testsuite/gas/mips/r3000@jal-svr4pic-noreorder.d
new file mode 100644
index 0000000..8419b82
--- /dev/null
+++ b/gas/testsuite/gas/mips/r3000@jal-svr4pic-noreorder.d
@@ -0,0 +1,5 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS jal-svr4pic noreorder
+#as: -32 -KPIC
+#source: jal-svr4pic-noreorder.s
+#dump: mips1@jal-svr4pic-noreorder.d