aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-arm.c19
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/arm/adr.d9
-rw-r--r--gas/testsuite/gas/arm/adr.s5
5 files changed, 40 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ed60ccb..f4bbc8d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-24 Sandra Loosemore <sandra@codesourcery.com>
+ Jie Zhang <jzhang918@gmail.com>
+
+ * config/tc-arm.c (md_apply_fix): Use encoding A2 of ADR
+ if offset is negative.
+
2012-07-16 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* config/tc-i386.c: Add ADX, RDSEED and PRFCHW asm directives.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 004f751..795a1b5 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -20637,13 +20637,22 @@ md_apply_fix (fixS * fixP,
}
}
- newimm = encode_arm_immediate (value);
temp = md_chars_to_number (buf, INSN_SIZE);
- /* If the instruction will fail, see if we can fix things up by
- changing the opcode. */
- if (newimm == (unsigned int) FAIL
- && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL)
+ /* If the offset is negative, we should use encoding A2 for ADR. */
+ if ((temp & 0xfff0000) == 0x28f0000 && value < 0)
+ newimm = negate_data_op (&temp, value);
+ else
+ {
+ newimm = encode_arm_immediate (value);
+
+ /* If the instruction will fail, see if we can fix things up by
+ changing the opcode. */
+ if (newimm == (unsigned int) FAIL)
+ newimm = negate_data_op (&temp, value);
+ }
+
+ if (newimm == (unsigned int) FAIL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("invalid constant (%lx) after fixup"),
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 756b9d2..85968f8 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-24 Sandra Loosemore <sandra@codesourcery.com>
+ Jie Zhang <jzhang918@gmail.com>
+
+ * gas/arm/adr.d: New test.
+ * gas/arm/adr.s: New test.
+
2012-07-16 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* gas/i386/i386.exp: Run adx, rdseed and prefetchw tests.
diff --git a/gas/testsuite/gas/arm/adr.d b/gas/testsuite/gas/arm/adr.d
new file mode 100644
index 0000000..ee74154
--- /dev/null
+++ b/gas/testsuite/gas/arm/adr.d
@@ -0,0 +1,9 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: ADR
+
+# Test the `ADR' pseudo-op
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+ <.*> 824ff203 subhi pc, pc, #805306368 ; 0x30000000
diff --git a/gas/testsuite/gas/arm/adr.s b/gas/testsuite/gas/arm/adr.s
new file mode 100644
index 0000000..5d8ea2b
--- /dev/null
+++ b/gas/testsuite/gas/arm/adr.s
@@ -0,0 +1,5 @@
+ @ test ADR pseudo-op
+ .text
+ .global foo
+foo:
+ adrhi pc, . - 0x2ffffff8