summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fortune <matthew.fortune@imgtec.com>2014-12-16 12:39:22 +0000
committerMatthew Fortune <matthew.fortune@imgtec.com>2014-12-19 20:31:55 +0000
commit3cbabe78aa167e2d4def377c357d80179e955e43 (patch)
treefbf1d40c4e153b7ece3ec13af0fbe2df3eb57f7f
parentfab39d55fa914ad1cea809848899c76c64eaab9d (diff)
downloadbinutils-3cbabe78aa167e2d4def377c357d80179e955e43.tar.gz
binutils-3cbabe78aa167e2d4def377c357d80179e955e43.tar.bz2
binutils-3cbabe78aa167e2d4def377c357d80179e955e43.zip
Rework the alignment check for BFD_RELOC_MIPS_18_PCREL_S3.
gas/ * config/tc-mips.c (md_apply_fix): Apply alignment check to the symbol and offset rather than *valP for BFD_RELOC_MIPS_18_PCREL_S3. Also update the error message for BFD_RELOC_MIPS_19_PCREL_S2. gas/testsuite/ * gas/mips/r6-64.s: Remove .align directives from LDPC instructions and add further tests for LDPC. * gas/mips/r6-64-n32.d: remove the NOPs from LDPC expected output and update for new tests. * gas/mips/r6-64-n64.d: Likewise. * gas/mips/ldpc-unalign.l: New file. * gas/mips/ldpc-unalign.s: Likewise. * gas/mips/mips.exp: Run ldpc-unalign test.
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-mips.c12
-rw-r--r--gas/testsuite/ChangeLog11
-rw-r--r--gas/testsuite/gas/mips/ldpc-unalign.l9
-rw-r--r--gas/testsuite/gas/mips/ldpc-unalign.s18
-rw-r--r--gas/testsuite/gas/mips/mips.exp1
-rw-r--r--gas/testsuite/gas/mips/r6-64-n32.d17
-rw-r--r--gas/testsuite/gas/mips/r6-64-n64.d25
-rw-r--r--gas/testsuite/gas/mips/r6-64.s19
9 files changed, 93 insertions, 26 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 684098d5145..c3ac4a1f8b1 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-19 Matthew Fortune <matthew.fortune@imgtec.com>
+
+ * config/tc-mips.c (md_apply_fix): Apply alignment check
+ to the symbol and offset rather than *valP for
+ BFD_RELOC_MIPS_18_PCREL_S3. Also update the error message
+ for BFD_RELOC_MIPS_19_PCREL_S2.
+
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* config/tc-i386-intel.c (i386_operator): Remove last argument
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index cfc4fa542d2..c3e3e2a8f93 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -15008,10 +15008,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
case BFD_RELOC_MIPS_18_PCREL_S3:
- if ((*valP & 0x7) != 0)
+ if ((S_GET_VALUE (fixP->fx_addsy) & 0x7) != 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
- _("PC-relative access to misaligned address (%lx)"),
- (long) *valP);
+ _("PC-relative access using misaligned symbol (%lx)"),
+ (long) S_GET_VALUE (fixP->fx_addsy));
+ if ((fixP->fx_offset & 0x7) != 0)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("PC-relative access using misaligned offset (%lx)"),
+ (long) fixP->fx_offset);
gas_assert (!fixP->fx_done);
break;
@@ -15020,7 +15024,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if ((*valP & 0x3) != 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("PC-relative access to misaligned address (%lx)"),
- (long) *valP);
+ (long) (S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset));
gas_assert (!fixP->fx_done);
break;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 28fc1f32df4..d53d5181e44 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,16 @@
2014-12-19 Matthew Fortune <matthew.fortune@imgtec.com>
+ * gas/mips/r6-64.s: Remove .align directives from LDPC
+ instructions and add further tests for LDPC.
+ * gas/mips/r6-64-n32.d: remove the NOPs from LDPC expected
+ output and update for new tests.
+ * gas/mips/r6-64-n64.d: Likewise.
+ * gas/mips/ldpc-unalign.l: New file.
+ * gas/mips/ldpc-unalign.s: Likewise.
+ * gas/mips/mips.exp: Run ldpc-unalign test.
+
+2014-12-19 Matthew Fortune <matthew.fortune@imgtec.com>
+
* gas/mips/r6.s: Test JALRC and NAL
* gas/mips/r6-n32.d: Add expected output for JALRC and NAL.
* gas/mips/r6-n64.d: Likewise.
diff --git a/gas/testsuite/gas/mips/ldpc-unalign.l b/gas/testsuite/gas/mips/ldpc-unalign.l
new file mode 100644
index 00000000000..ddc515ba581
--- /dev/null
+++ b/gas/testsuite/gas/mips/ldpc-unalign.l
@@ -0,0 +1,9 @@
+.*: Assembler messages:
+.*:2: Error: PC-relative access using misaligned offset \(4\)
+.*:3: Error: PC-relative access using misaligned offset \(4\)
+.*:4: Error: PC-relative access using misaligned symbol \(1c\)
+.*:5: Error: PC-relative access using misaligned symbol \(1c\)
+.*:6: Error: PC-relative access using misaligned symbol \(1c\)
+.*:6: Error: PC-relative access using misaligned offset \(4\)
+.*:7: Error: PC-relative access using misaligned symbol \(1c\)
+.*:7: Error: PC-relative access using misaligned offset \(4\)
diff --git a/gas/testsuite/gas/mips/ldpc-unalign.s b/gas/testsuite/gas/mips/ldpc-unalign.s
new file mode 100644
index 00000000000..8b926cf3195
--- /dev/null
+++ b/gas/testsuite/gas/mips/ldpc-unalign.s
@@ -0,0 +1,18 @@
+ .text
+ ldpc $4, 1f+4
+ ldpc $4, 1f+4
+ ldpc $4, 2f
+ ldpc $4, 2f
+ ldpc $4, 2f+4
+ ldpc $4, 2f+4
+ .align 3
+1:
+ nop
+2:
+ nop
+ nop
+ nop
+
+# 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 6c0c9c8e4b4..1949cd8f9f8 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1446,6 +1446,7 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test_arches "r6-n64" [mips_arch_list_matching mips64r6]
run_dump_test_arches "r6-64-n32" [mips_arch_list_matching mips64r6]
run_dump_test_arches "r6-64-n64" [mips_arch_list_matching mips64r6]
+ run_list_test_arches "ldpc-unalign" "-64" [mips_arch_list_matching mips64r6]
}
run_list_test_arches "r6-removed" "-32" [mips_arch_list_matching mips32r6]
run_list_test_arches "r6-64-removed" [mips_arch_list_matching mips64r6]
diff --git a/gas/testsuite/gas/mips/r6-64-n32.d b/gas/testsuite/gas/mips/r6-64-n32.d
index 6d471c658d9..fcef172b09a 100644
--- a/gas/testsuite/gas/mips/r6-64-n32.d
+++ b/gas/testsuite/gas/mips/r6-64-n32.d
@@ -44,18 +44,21 @@ Disassembly of section .text:
[ ]*78: R_MIPS_PC19_S2 L0.+0xffffc
0+007c <[^>]*> ec940000 lwupc a0,fff0007c <[^>]*>
0+0080 <[^>]*> ec93ffff lwupc a0,0010007c <[^>]*>
-0+0084 <[^>]*> 00000000 nop
+0+0084 <[^>]*> ec980000 ldpc a0,00000080 <[^>]*>
+[ ]*84: R_MIPS_PC18_S3 \.L1.1
0+0088 <[^>]*> ec980000 ldpc a0,00000088 <[^>]*>
[ ]*88: R_MIPS_PC18_S3 \.L1.1
0+008c <[^>]*> 00000000 nop
0+0090 <[^>]*> ec980000 ldpc a0,00000090 <[^>]*>
-[ ]*90: R_MIPS_PC18_S3 L0.-0x100000
-0+0094 <[^>]*> 00000000 nop
+[ ]*90: R_MIPS_PC18_S3 \.L3.1-0x100000
+0+0094 <[^>]*> ec980000 ldpc a0,00000090 <[^>]*>
+[ ]*94: R_MIPS_PC18_S3 \.L3.1-0x100000
0+0098 <[^>]*> ec980000 ldpc a0,00000098 <[^>]*>
-[ ]*98: R_MIPS_PC18_S3 L0.+0xffff8
-0+009c <[^>]*> 00000000 nop
+[ ]*98: R_MIPS_PC18_S3 \.L3.2\+0xffff8
+0+009c <[^>]*> ec980000 ldpc a0,00000098 <[^>]*>
+[ ]*9c: R_MIPS_PC18_S3 \.L3.2\+0xffff8
0+00a0 <[^>]*> ec9a0000 ldpc a0,fff000a0 <[^>]*>
-0+00a4 <[^>]*> 00000000 nop
+0+00a4 <[^>]*> ec9a0000 ldpc a0,fff000a0 <[^>]*>
0+00a8 <[^>]*> ec99ffff ldpc a0,001000a0 <[^>]*>
-0+00ac <[^>]*> 00000000 nop
+0+00ac <[^>]*> ec99ffff ldpc a0,001000a0 <[^>]*>
\.\.\.
diff --git a/gas/testsuite/gas/mips/r6-64-n64.d b/gas/testsuite/gas/mips/r6-64-n64.d
index 22028208145..42d8e532ed2 100644
--- a/gas/testsuite/gas/mips/r6-64-n64.d
+++ b/gas/testsuite/gas/mips/r6-64-n64.d
@@ -50,24 +50,33 @@ Disassembly of section .text:
[ ]*78: R_MIPS_NONE \*ABS\*\+0xffffc
0+007c <[^>]*> ec940000 lwupc a0,f+ff0007c <[^>]*>
0+0080 <[^>]*> ec93ffff lwupc a0,0+010007c <[^>]*>
-0+0084 <[^>]*> 00000000 nop
+0+0084 <[^>]*> ec980000 ldpc a0,0+0000080 <[^>]*>
+[ ]*84: R_MIPS_PC18_S3 .L1.1
+[ ]*84: R_MIPS_NONE \*ABS\*
+[ ]*84: R_MIPS_NONE \*ABS\*
0+0088 <[^>]*> ec980000 ldpc a0,0+0000088 <[^>]*>
-[ ]*88: R_MIPS_PC18_S3 \.L1.1
+[ ]*88: R_MIPS_PC18_S3 .L1.1
[ ]*88: R_MIPS_NONE \*ABS\*
[ ]*88: R_MIPS_NONE \*ABS\*
0+008c <[^>]*> 00000000 nop
0+0090 <[^>]*> ec980000 ldpc a0,0+0000090 <[^>]*>
-[ ]*90: R_MIPS_PC18_S3 L0.-0x100000
+[ ]*90: R_MIPS_PC18_S3 .L3.1-0x100000
[ ]*90: R_MIPS_NONE \*ABS\*-0x100000
[ ]*90: R_MIPS_NONE \*ABS\*-0x100000
-0+0094 <[^>]*> 00000000 nop
+0+0094 <[^>]*> ec980000 ldpc a0,0+0000090 <[^>]*>
+[ ]*94: R_MIPS_PC18_S3 .L3.1-0x100000
+[ ]*94: R_MIPS_NONE \*ABS\*-0x100000
+[ ]*94: R_MIPS_NONE \*ABS\*-0x100000
0+0098 <[^>]*> ec980000 ldpc a0,0+0000098 <[^>]*>
-[ ]*98: R_MIPS_PC18_S3 L0.\+0xffff8
+[ ]*98: R_MIPS_PC18_S3 .L3.2\+0xffff8
[ ]*98: R_MIPS_NONE \*ABS\*\+0xffff8
[ ]*98: R_MIPS_NONE \*ABS\*\+0xffff8
-0+009c <[^>]*> 00000000 nop
+0+009c <[^>]*> ec980000 ldpc a0,0+0000098 <[^>]*>
+[ ]*9c: R_MIPS_PC18_S3 .L3.2\+0xffff8
+[ ]*9c: R_MIPS_NONE \*ABS\*\+0xffff8
+[ ]*9c: R_MIPS_NONE \*ABS\*\+0xffff8
0+00a0 <[^>]*> ec9a0000 ldpc a0,f+ff000a0 <[^>]*>
-0+00a4 <[^>]*> 00000000 nop
+0+00a4 <[^>]*> ec9a0000 ldpc a0,f+ff000a0 <[^>]*>
0+00a8 <[^>]*> ec99ffff ldpc a0,0+01000a0 <[^>]*>
-0+00ac <[^>]*> 00000000 nop
+0+00ac <[^>]*> ec99ffff ldpc a0,0+01000a0 <[^>]*>
\.\.\.
diff --git a/gas/testsuite/gas/mips/r6-64.s b/gas/testsuite/gas/mips/r6-64.s
index 7a97ad2490c..2d577d8e002 100644
--- a/gas/testsuite/gas/mips/r6-64.s
+++ b/gas/testsuite/gas/mips/r6-64.s
@@ -40,19 +40,24 @@
lwu $4, (-262144 << 2)($pc)
lwu $4, (262143 << 2)($pc)
- .align 3
ldpc $4, 1f
- .align 3
- ldpc $4, .+(-131072 << 3)
- .align 3
- ldpc $4, .+(131071 << 3)
- .align 3
+ ldpc $4, 1f
+ .align 3
+3:
+ ldpc $4, 3b+(-131072 << 3)
+ ldpc $4, 3b+(-131072 << 3)
+ .align 3
+3:
+ ldpc $4, 3b+(131071 << 3)
+ ldpc $4, 3b+(131071 << 3)
ld $4, (-131072 << 3)($pc)
- .align 3
+ ld $4, (-131072 << 3)($pc)
+ ld $4, (131071 << 3)($pc)
ld $4, (131071 << 3)($pc)
.align 3
1:
nop
+ nop
# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 2