summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-04-30 23:36:15 +0000
committerPaul Brook <paul@codesourcery.com>2005-04-30 23:36:15 +0000
commita954fefb0200f9f7d903921db22d6f0751014b5a (patch)
tree1b135a0fd564b9962d46320aab95d9356abcc3d9
parent9d858fdbb5995b4aa9addf48aed21a8233eba727 (diff)
downloadgdb-a954fefb0200f9f7d903921db22d6f0751014b5a.tar.gz
2005-05-01 Zack Weinberg <zack@codesourcery.com>
* gas/config/tc-arm.c (encode_thumb32_addr_mode): Set inst.reloc.pc_rel if is_pc. (T16_32_TAB): Delete unused entry for BLX. (do_t_ldst): Don't offset inst.reloc.exp.X_add_number for PC-relative addressing. (md_pcrel_from): Report the adjusted PC for BFD_RELOC_ARM_THUMB_OFFSET and BFD_RELOC_ARM_T32_OFFSET_IMM. (md_apply_fix3): Correct bitmasks for BFD_RELOC_ARM_T32_OFFSET_IMM. Do not round up value for PC-relative BFD_RELOC_ARM_THUMB_OFFSET. * gas/testsuite/gas/arm/thumb.s: Test PC-relative ldr more thoroughly. * gas/testsuite/gas/arm/thumb.d: Update to match. * gas/testsuite/gas/arm/thumb32.s: Properly align labels that will be targeted by blx instructions. * gas/testsuite/gas/arm/thumb32.d: Update to match. Correct expected dissassembly of PC-relative ldr. * gas/testsuite/gas/arm/macro1.s: Add leading label and trailing padding for a.out compatibility. * gas/testsuite/gas/arm/macro1.d: Update to match. * gas/testsuite/gas/arm/tcompat2.s: Add trailing padding for a.out compatibility. * gas/testsuite/gas/arm/tcompat2.d: Update to match. * opcodes/arm-dis.c (print_insn_thumb32): Reorganize %a and %A handling. Call info->print_address_func when %a/%A are applied to a PC-relative instruction.
-rw-r--r--ChangeLog.csl31
-rw-r--r--opcodes/arm-dis.c72
2 files changed, 74 insertions, 29 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 46afaf35937..f15ae7cf1f6 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,34 @@
+2005-05-01 Zack Weinberg <zack@codesourcery.com>
+
+ * gas/config/tc-arm.c (encode_thumb32_addr_mode): Set inst.reloc.pc_rel
+ if is_pc.
+ (T16_32_TAB): Delete unused entry for BLX.
+ (do_t_ldst): Don't offset inst.reloc.exp.X_add_number for PC-relative
+ addressing.
+ (md_pcrel_from): Report the adjusted PC for
+ BFD_RELOC_ARM_THUMB_OFFSET and BFD_RELOC_ARM_T32_OFFSET_IMM.
+ (md_apply_fix3): Correct bitmasks for BFD_RELOC_ARM_T32_OFFSET_IMM.
+ Do not round up value for PC-relative BFD_RELOC_ARM_THUMB_OFFSET.
+
+ * gas/testsuite/gas/arm/thumb.s: Test PC-relative ldr more thoroughly.
+ * gas/testsuite/gas/arm/thumb.d: Update to match.
+
+ * gas/testsuite/gas/arm/thumb32.s: Properly align labels that
+ will be targeted by blx instructions.
+ * gas/testsuite/gas/arm/thumb32.d: Update to match. Correct
+ expected dissassembly of PC-relative ldr.
+
+ * gas/testsuite/gas/arm/macro1.s: Add leading label and
+ trailing padding for a.out compatibility.
+ * gas/testsuite/gas/arm/macro1.d: Update to match.
+ * gas/testsuite/gas/arm/tcompat2.s: Add trailing padding for a.out
+ compatibility.
+ * gas/testsuite/gas/arm/tcompat2.d: Update to match.
+
+ * opcodes/arm-dis.c (print_insn_thumb32): Reorganize %a and %A
+ handling. Call info->print_address_func when %a/%A are applied
+ to a PC-relative instruction.
+
2005-04-29 Zack Weinberg <zack@codesourcery.com>
* gas/sb.c: Include as.h.
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index bb377a8ef82..001ef5550af 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -2278,61 +2278,75 @@ print_insn_thumb32 (pc, info, given)
unsigned int op = (given & 0x00000f00) >> 8;
unsigned int i12 = (given & 0x00000fff);
unsigned int i8 = (given & 0x000000ff);
+ bfd_boolean writeback = FALSE, postind = FALSE;
+ int offset = 0;
func (stream, "[%s", arm_regnames[Rn]);
if (U) /* 12-bit positive immediate offset */
+ offset = i12;
+ else if (Rn == 15) /* 12-bit negative immediate offset */
+ offset = -(int)i12;
+ else if (op == 0x0) /* shifted register offset */
{
- if (i12)
- func (stream, ", #%u", i12);
+ unsigned int Rm = (i8 & 0x0f);
+ unsigned int sh = (i8 & 0x30) >> 4;
+ func (stream, ", %s", arm_regnames[Rm]);
+ if (sh)
+ func (stream, ", lsl #%u", sh);
func (stream, "]");
+ break;
}
- else if (Rn == 15) /* 12-bit negative immediate offset */
- func (stream, ", #-%u]", i12);
else switch (op)
{
- case 0x0: /* shifted register offset */
- {
- unsigned int Rm = (i8 & 0x0f);
- unsigned int sh = (i8 & 0x30) >> 4;
- func (stream, ", %s", arm_regnames[Rm]);
- if (sh)
- func (stream, ", lsl #%u", sh);
- func (stream, "]");
- }
- break;
-
case 0xE: /* 8-bit positive immediate offset */
- if (i8)
- func (stream, ", #%u", i8);
- func (stream, "]");
+ offset = i8;
break;
case 0xC: /* 8-bit negative immediate offset */
- func (stream, ", #-%u]", i8);
+ offset = -i8;
break;
case 0xB: /* 8-bit + preindex with wb */
- if (i8)
- func (stream, ", #%u", i8);
- func (stream, "]!");
+ offset = i8;
+ writeback = TRUE;
break;
case 0x9: /* 8-bit - preindex with wb */
- func (stream, ", #-%u]!", i8);
+ offset = -i8;
+ writeback = TRUE;
break;
case 0xF: /* 8-bit + postindex */
- func (stream, "], #%u", i8);
+ offset = i8;
+ postind = TRUE;
break;
case 0xD: /* 8-bit - postindex */
- func (stream, "], #-%u", i8);
+ offset = -i8;
+ postind = TRUE;
break;
default:
func (stream, ", <undefined>]");
+ goto skip;
+ }
+
+ if (postind)
+ func (stream, "], #%d", offset);
+ else
+ {
+ if (offset)
+ func (stream, ", #%d", offset);
+ func (stream, writeback ? "]!" : "]");
+ }
+
+ if (Rn == 15)
+ {
+ func (stream, "\t; ");
+ info->print_address_func (((pc + 4) & ~3) + offset, info);
}
}
+ skip:
break;
case 'A':
@@ -2425,7 +2439,7 @@ print_insn_thumb32 (pc, info, given)
unsigned int S = (given & 0x04000000u) >> 26;
unsigned int J1 = (given & 0x00002000u) >> 13;
unsigned int J2 = (given & 0x00000800u) >> 11;
- unsigned int offset = 0;
+ int offset = 0;
offset |= !S << 20;
offset |= J2 << 19;
@@ -2434,7 +2448,7 @@ print_insn_thumb32 (pc, info, given)
offset |= (given & 0x000007ff) << 1;
offset -= (1 << 20);
- info->print_address_func ((bfd_vma)offset + pc + 4, info);
+ info->print_address_func (pc + 4 + offset, info);
}
break;
@@ -2443,7 +2457,7 @@ print_insn_thumb32 (pc, info, given)
unsigned int S = (given & 0x04000000u) >> 26;
unsigned int I1 = (given & 0x00002000u) >> 13;
unsigned int I2 = (given & 0x00000800u) >> 11;
- unsigned int offset = 0;
+ int offset = 0;
offset |= !S << 24;
offset |= !(I1 ^ S) << 23;
@@ -2452,7 +2466,7 @@ print_insn_thumb32 (pc, info, given)
offset |= (given & 0x000007ffu) << 1;
offset -= (1 << 24);
- info->print_address_func ((bfd_vma)offset + pc + 4, info);
+ info->print_address_func (pc + 4 + offset, info);
}
break;