diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2012-07-24 16:38:35 +0000 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2012-07-24 16:38:35 +0000 |
commit | 5e73442d4c1ea1261339be580fb0f12bdc4b9e29 (patch) | |
tree | cf0ba2c8d4a417066f1db3dd93ac5ebc4fc0ea70 /gas/config | |
parent | 108fb0f719bbf3f627d6ff34ba0f26b67aa971b5 (diff) | |
download | gdb-5e73442d4c1ea1261339be580fb0f12bdc4b9e29.zip gdb-5e73442d4c1ea1261339be580fb0f12bdc4b9e29.tar.gz gdb-5e73442d4c1ea1261339be580fb0f12bdc4b9e29.tar.bz2 |
2012-07-24 Sandra Loosemore <sandra@codesourcery.com>
Jie Zhang <jzhang918@gmail.com>
gas/
* config/tc-arm.c (md_apply_fix): Use encoding A2 of ADR
if offset is negative.
gas/testsuite/
* gas/arm/adr.d: New test.
* gas/arm/adr.s: New test.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arm.c | 19 |
1 files changed, 14 insertions, 5 deletions
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"), |