• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版0e8142adb1dfe1acbe8c71a70d8fb002b2f60243 (tree)
时间2005-05-01 08:36:15
作者Paul Brook <paul@code...>
CommiterPaul Brook

Log Message

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.

更改概述

差异

--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,34 @@
1+2005-05-01 Zack Weinberg <zack@codesourcery.com>
2+
3+ * gas/config/tc-arm.c (encode_thumb32_addr_mode): Set inst.reloc.pc_rel
4+ if is_pc.
5+ (T16_32_TAB): Delete unused entry for BLX.
6+ (do_t_ldst): Don't offset inst.reloc.exp.X_add_number for PC-relative
7+ addressing.
8+ (md_pcrel_from): Report the adjusted PC for
9+ BFD_RELOC_ARM_THUMB_OFFSET and BFD_RELOC_ARM_T32_OFFSET_IMM.
10+ (md_apply_fix3): Correct bitmasks for BFD_RELOC_ARM_T32_OFFSET_IMM.
11+ Do not round up value for PC-relative BFD_RELOC_ARM_THUMB_OFFSET.
12+
13+ * gas/testsuite/gas/arm/thumb.s: Test PC-relative ldr more thoroughly.
14+ * gas/testsuite/gas/arm/thumb.d: Update to match.
15+
16+ * gas/testsuite/gas/arm/thumb32.s: Properly align labels that
17+ will be targeted by blx instructions.
18+ * gas/testsuite/gas/arm/thumb32.d: Update to match. Correct
19+ expected dissassembly of PC-relative ldr.
20+
21+ * gas/testsuite/gas/arm/macro1.s: Add leading label and
22+ trailing padding for a.out compatibility.
23+ * gas/testsuite/gas/arm/macro1.d: Update to match.
24+ * gas/testsuite/gas/arm/tcompat2.s: Add trailing padding for a.out
25+ compatibility.
26+ * gas/testsuite/gas/arm/tcompat2.d: Update to match.
27+
28+ * opcodes/arm-dis.c (print_insn_thumb32): Reorganize %a and %A
29+ handling. Call info->print_address_func when %a/%A are applied
30+ to a PC-relative instruction.
31+
132 2005-04-29 Zack Weinberg <zack@codesourcery.com>
233
334 * gas/sb.c: Include as.h.
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -5639,6 +5639,7 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d)
56395639 inst.instruction |= 0x00000100;
56405640 }
56415641 inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_IMM;
5642+ inst.reloc.pc_rel = is_pc;
56425643 }
56435644 else if (inst.operands[i].postind)
56445645 {
@@ -5672,7 +5673,6 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d)
56725673 X(asrs, 1000, fa50f000), \
56735674 X(bic, 4380, ea200000), \
56745675 X(bics, 4380, ea300000), \
5675- X(blx, 4780, f000c000), \
56765676 X(cmn, 42c0, eb100f00), \
56775677 X(cmp, 2800, ebb00f00), \
56785678 X(cpsie, b660, f3af8400), \
@@ -6454,8 +6454,6 @@ do_t_ldst (void)
64546454
64556455 inst.instruction |= inst.operands[0].reg << 8;
64566456 inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET;
6457- if (inst.reloc.pc_rel)
6458- inst.reloc.exp.X_add_number -= 4; /* pipeline offset */
64596457 return;
64606458 }
64616459
@@ -9664,12 +9662,21 @@ md_pcrel_from (fixS * fixP)
96649662 && fixP->fx_subsy == NULL)
96659663 return 0;
96669664
9667- if (fixP->fx_pcrel && (fixP->fx_r_type == BFD_RELOC_ARM_THUMB_ADD))
9665+ /* PC relative addressing on the Thumb is slightly odd as the bottom
9666+ two bits of the PC are forced to zero for the calculation. This
9667+ happens *after* application of the pipeline offset. However,
9668+ Thumb adrl already adjusts for this, so we need not do it again. */
9669+ switch (fixP->fx_r_type)
96689670 {
9669- /* PC relative addressing on the Thumb is slightly odd
9670- as the bottom two bits of the PC are forced to zero
9671- for the calculation. */
9671+ case BFD_RELOC_ARM_THUMB_ADD:
96729672 return (fixP->fx_where + fixP->fx_frag->fr_address) & ~3;
9673+
9674+ case BFD_RELOC_ARM_THUMB_OFFSET:
9675+ case BFD_RELOC_ARM_T32_OFFSET_IMM:
9676+ return (fixP->fx_where + fixP->fx_frag->fr_address + 4) & ~3;
9677+
9678+ default:
9679+ break;
96739680 }
96749681
96759682 #ifdef TE_WINCE
@@ -9866,7 +9873,7 @@ md_apply_fix3 (fixS * fixP,
98669873
98679874 /* If this symbol is in a different section then we need to leave it for
98689875 the linker to deal with. Unfortunately, md_pcrel_from can't tell,
9869- so we have to undo it's effects here. */
9876+ so we have to undo its effects here. */
98709877 if (fixP->fx_pcrel)
98719878 {
98729879 if (fixP->fx_addsy != NULL
@@ -10073,7 +10080,7 @@ md_apply_fix3 (fixS * fixP,
1007310080 }
1007410081 newval &= ~0xff;
1007510082 }
10076- else if ((newval & 0x0000f000) == 0x0000f0000)
10083+ else if ((newval & 0x000f0000) == 0x000f0000)
1007710084 {
1007810085 /* PC-relative, 12-bit offset. */
1007910086 if (value >= 0)
@@ -10680,24 +10687,20 @@ md_apply_fix3 (fixS * fixP,
1068010687 {
1068110688 case 4: /* PC load. */
1068210689 /* Thumb PC loads are somewhat odd, bit 1 of the PC is
10683- forced to zero for these loads, so we will need to round
10684- up the offset if the instruction address is not word
10685- aligned (since the final address produced must be, and
10686- we can only describe word-aligned immediate offsets). */
10687-
10690+ forced to zero for these loads; md_pcrel_from has already
10691+ compensated for this. */
1068810692 if (value & 3)
1068910693 as_bad_where (fixP->fx_file, fixP->fx_line,
1069010694 _("invalid offset, target not word aligned (0x%08lX)"),
1069110695 (((unsigned int) fixP->fx_frag->fr_address
1069210696 + (unsigned int) fixP->fx_where) & ~3) + value);
1069310697
10694- if ((value + 2) & ~0x3fe)
10698+ if (value & ~0x3fc)
1069510699 as_bad_where (fixP->fx_file, fixP->fx_line,
1069610700 _("invalid offset, value too big (0x%08lX)"),
1069710701 (long) value);
1069810702
10699- /* Round up, since pc will be rounded down. */
10700- newval |= (value + 2) >> 2;
10703+ newval |= value >> 2;
1070110704 break;
1070210705
1070310706 case 9: /* SP load/store. */
--- a/gas/testsuite/gas/arm/macro1.d
+++ b/gas/testsuite/gas/arm/macro1.d
@@ -7,3 +7,6 @@
77 Disassembly of section .text:
88
99 0+0 <[^>]*> e8bd8030 ? ldmia sp!, {r4, r5, pc}
10+0+4 <[^>]*> e1a00000 ? nop \(mov r0,r0\)
11+0+8 <[^>]*> e1a00000 ? nop \(mov r0,r0\)
12+0+c <[^>]*> e1a00000 ? nop \(mov r0,r0\)
--- a/gas/testsuite/gas/arm/macro1.s
+++ b/gas/testsuite/gas/arm/macro1.s
@@ -3,4 +3,10 @@
33 ldmia sp!, {\regs, pc}
44 .endm
55 .text
6+l:
67 popret "r4, r5"
8+
9+ @ section padding for a.out's sake
10+ nop
11+ nop
12+ nop
--- a/gas/testsuite/gas/arm/tcompat2.d
+++ b/gas/testsuite/gas/arm/tcompat2.d
@@ -20,3 +20,7 @@ Disassembly of section .text:
2020 0+12 <[^>]*> 4308 * orrs r0, r1
2121 0+14 <[^>]*> 4388 * bics r0, r1
2222 0+16 <[^>]*> 4188 * sbcs r0, r1
23+0+18 <[^>]*> 46c0 * nop \(mov r8, r8\)
24+0+1a <[^>]*> 46c0 * nop \(mov r8, r8\)
25+0+1c <[^>]*> 46c0 * nop \(mov r8, r8\)
26+0+1e <[^>]*> 46c0 * nop \(mov r8, r8\)
--- a/gas/testsuite/gas/arm/tcompat2.s
+++ b/gas/testsuite/gas/arm/tcompat2.s
@@ -25,3 +25,8 @@ m:
2525
2626 sbc r0,r0,r1
2727
28+ @ section padding for a.out's sake
29+ nop
30+ nop
31+ nop
32+ nop
--- a/gas/testsuite/gas/arm/thumb.d
+++ b/gas/testsuite/gas/arm/thumb.d
@@ -181,3 +181,9 @@ Disassembly of section \.text:
181181 \.\.\.
182182 0+938 <[^>]+> f000 f898 bl 0+134 <[^>]+>
183183 938: R_ARM_THM_CALL \.text
184+0+93c <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\)
185+0+93e <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\)
186+0+940 <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+948 <[^>]+>\)
187+0+942 <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+948 <[^>]+>\)
188+0+944 <[^>]+> 46c0 nop \(mov r8, r8\)
189+0+946 <[^>]+> 46c0 nop \(mov r8, r8\)
--- a/gas/testsuite/gas/arm/thumb.s
+++ b/gas/testsuite/gas/arm/thumb.s
@@ -192,3 +192,11 @@ forwardonly:
192192 .space (1 << 11) @ leave space to force long offsets
193193 .local:
194194 bl .back
195+
196+ ldr r0, .target
197+ ldr r0, .target
198+ ldr r0, [pc, #4]
199+ ldr r0, [pc, #4]
200+.target:
201+ nop @ pad for a.out
202+ nop
--- a/gas/testsuite/gas/arm/thumb32.d
+++ b/gas/testsuite/gas/arm/thumb32.d
@@ -209,100 +209,100 @@ Disassembly of section .text:
209209 0+2ce <[^>]+> f3c0 5040 ubfx r0, r0, #21, #1
210210 0+2d2 <[^>]+> f340 0011 sbfx r0, r0, #0, #18
211211 0+2d6 <[^>]+> d0fe beq\.n 0+2d6 <[^>]+>
212-0+2d8 <[^>]+> d029 beq\.n 0+32e <[^>]+>
212+0+2d8 <[^>]+> d02a beq\.n 0+330 <[^>]+>
213213 0+2da <[^>]+> d1fc bne\.n 0+2d6 <[^>]+>
214-0+2dc <[^>]+> d127 bne\.n 0+32e <[^>]+>
214+0+2dc <[^>]+> d128 bne\.n 0+330 <[^>]+>
215215 0+2de <[^>]+> d2fa bcs\.n 0+2d6 <[^>]+>
216-0+2e0 <[^>]+> d225 bcs\.n 0+32e <[^>]+>
216+0+2e0 <[^>]+> d226 bcs\.n 0+330 <[^>]+>
217217 0+2e2 <[^>]+> d2f8 bcs\.n 0+2d6 <[^>]+>
218-0+2e4 <[^>]+> d223 bcs\.n 0+32e <[^>]+>
218+0+2e4 <[^>]+> d224 bcs\.n 0+330 <[^>]+>
219219 0+2e6 <[^>]+> d3f6 bcc\.n 0+2d6 <[^>]+>
220-0+2e8 <[^>]+> d321 bcc\.n 0+32e <[^>]+>
220+0+2e8 <[^>]+> d322 bcc\.n 0+330 <[^>]+>
221221 0+2ea <[^>]+> d3f4 bcc\.n 0+2d6 <[^>]+>
222-0+2ec <[^>]+> d31f bcc\.n 0+32e <[^>]+>
222+0+2ec <[^>]+> d320 bcc\.n 0+330 <[^>]+>
223223 0+2ee <[^>]+> d3f2 bcc\.n 0+2d6 <[^>]+>
224-0+2f0 <[^>]+> d31d bcc\.n 0+32e <[^>]+>
224+0+2f0 <[^>]+> d31e bcc\.n 0+330 <[^>]+>
225225 0+2f2 <[^>]+> d4f0 bmi\.n 0+2d6 <[^>]+>
226-0+2f4 <[^>]+> d41b bmi\.n 0+32e <[^>]+>
226+0+2f4 <[^>]+> d41c bmi\.n 0+330 <[^>]+>
227227 0+2f6 <[^>]+> d5ee bpl\.n 0+2d6 <[^>]+>
228-0+2f8 <[^>]+> d519 bpl\.n 0+32e <[^>]+>
228+0+2f8 <[^>]+> d51a bpl\.n 0+330 <[^>]+>
229229 0+2fa <[^>]+> d6ec bvs\.n 0+2d6 <[^>]+>
230-0+2fc <[^>]+> d617 bvs\.n 0+32e <[^>]+>
230+0+2fc <[^>]+> d618 bvs\.n 0+330 <[^>]+>
231231 0+2fe <[^>]+> d7ea bvc\.n 0+2d6 <[^>]+>
232-0+300 <[^>]+> d715 bvc\.n 0+32e <[^>]+>
232+0+300 <[^>]+> d716 bvc\.n 0+330 <[^>]+>
233233 0+302 <[^>]+> d8e8 bhi\.n 0+2d6 <[^>]+>
234-0+304 <[^>]+> d813 bhi\.n 0+32e <[^>]+>
234+0+304 <[^>]+> d814 bhi\.n 0+330 <[^>]+>
235235 0+306 <[^>]+> d9e6 bls\.n 0+2d6 <[^>]+>
236-0+308 <[^>]+> d911 bls\.n 0+32e <[^>]+>
236+0+308 <[^>]+> d912 bls\.n 0+330 <[^>]+>
237237 0+30a <[^>]+> d7e4 bvc\.n 0+2d6 <[^>]+>
238-0+30c <[^>]+> d70f bvc\.n 0+32e <[^>]+>
238+0+30c <[^>]+> d710 bvc\.n 0+330 <[^>]+>
239239 0+30e <[^>]+> d8e2 bhi\.n 0+2d6 <[^>]+>
240-0+310 <[^>]+> d80d bhi\.n 0+32e <[^>]+>
240+0+310 <[^>]+> d80e bhi\.n 0+330 <[^>]+>
241241 0+312 <[^>]+> d9e0 bls\.n 0+2d6 <[^>]+>
242-0+314 <[^>]+> d90b bls\.n 0+32e <[^>]+>
242+0+314 <[^>]+> d90c bls\.n 0+330 <[^>]+>
243243 0+316 <[^>]+> dade bge\.n 0+2d6 <[^>]+>
244-0+318 <[^>]+> da09 bge\.n 0+32e <[^>]+>
244+0+318 <[^>]+> da0a bge\.n 0+330 <[^>]+>
245245 0+31a <[^>]+> dbdc blt\.n 0+2d6 <[^>]+>
246-0+31c <[^>]+> db07 blt\.n 0+32e <[^>]+>
246+0+31c <[^>]+> db08 blt\.n 0+330 <[^>]+>
247247 0+31e <[^>]+> dcda bgt\.n 0+2d6 <[^>]+>
248-0+320 <[^>]+> dc05 bgt\.n 0+32e <[^>]+>
248+0+320 <[^>]+> dc06 bgt\.n 0+330 <[^>]+>
249249 0+322 <[^>]+> ddd8 ble\.n 0+2d6 <[^>]+>
250-0+324 <[^>]+> dd03 ble\.n 0+32e <[^>]+>
250+0+324 <[^>]+> dd04 ble\.n 0+330 <[^>]+>
251251 0+326 <[^>]+> ded6 bal\.n 0+2d6 <[^>]+>
252-0+328 <[^>]+> de01 bal\.n 0+32e <[^>]+>
252+0+328 <[^>]+> de02 bal\.n 0+330 <[^>]+>
253253 0+32a <[^>]+> e7d4 b\.n 0+2d6 <[^>]+>
254-0+32c <[^>]+> e7ff b\.n 0+32e <[^>]+>
255-0+32e <[^>]+> f43f affe beq\.w 0+32e <[^>]+>
256-0+332 <[^>]+> f000 8058 beq\.w 0+3e6 <[^>]+>
257-0+336 <[^>]+> f47f affa bne\.w 0+32e <[^>]+>
258-0+33a <[^>]+> f040 8054 bne\.w 0+3e6 <[^>]+>
259-0+33e <[^>]+> f4bf aff6 bcs\.w 0+32e <[^>]+>
260-0+342 <[^>]+> f080 8050 bcs\.w 0+3e6 <[^>]+>
261-0+346 <[^>]+> f4bf aff2 bcs\.w 0+32e <[^>]+>
262-0+34a <[^>]+> f080 804c bcs\.w 0+3e6 <[^>]+>
263-0+34e <[^>]+> f4ff afee bcc\.w 0+32e <[^>]+>
264-0+352 <[^>]+> f0c0 8048 bcc\.w 0+3e6 <[^>]+>
265-0+356 <[^>]+> f4ff afea bcc\.w 0+32e <[^>]+>
266-0+35a <[^>]+> f0c0 8044 bcc\.w 0+3e6 <[^>]+>
267-0+35e <[^>]+> f4ff afe6 bcc\.w 0+32e <[^>]+>
268-0+362 <[^>]+> f0c0 8040 bcc\.w 0+3e6 <[^>]+>
269-0+366 <[^>]+> f53f afe2 bmi\.w 0+32e <[^>]+>
270-0+36a <[^>]+> f100 803c bmi\.w 0+3e6 <[^>]+>
271-0+36e <[^>]+> f57f afde bpl\.w 0+32e <[^>]+>
272-0+372 <[^>]+> f140 8038 bpl\.w 0+3e6 <[^>]+>
273-0+376 <[^>]+> f5bf afda bvs\.w 0+32e <[^>]+>
274-0+37a <[^>]+> f180 8034 bvs\.w 0+3e6 <[^>]+>
275-0+37e <[^>]+> f5ff afd6 bvc\.w 0+32e <[^>]+>
276-0+382 <[^>]+> f1c0 8030 bvc\.w 0+3e6 <[^>]+>
277-0+386 <[^>]+> f63f afd2 bhi\.w 0+32e <[^>]+>
278-0+38a <[^>]+> f200 802c bhi\.w 0+3e6 <[^>]+>
279-0+38e <[^>]+> f67f afce bls\.w 0+32e <[^>]+>
280-0+392 <[^>]+> f240 8028 bls\.w 0+3e6 <[^>]+>
281-0+396 <[^>]+> f5ff afca bvc\.w 0+32e <[^>]+>
282-0+39a <[^>]+> f1c0 8024 bvc\.w 0+3e6 <[^>]+>
283-0+39e <[^>]+> f63f afc6 bhi\.w 0+32e <[^>]+>
284-0+3a2 <[^>]+> f200 8020 bhi\.w 0+3e6 <[^>]+>
285-0+3a6 <[^>]+> f67f afc2 bls\.w 0+32e <[^>]+>
286-0+3aa <[^>]+> f240 801c bls\.w 0+3e6 <[^>]+>
287-0+3ae <[^>]+> f6bf afbe bge\.w 0+32e <[^>]+>
288-0+3b2 <[^>]+> f280 8018 bge\.w 0+3e6 <[^>]+>
289-0+3b6 <[^>]+> f6ff afba blt\.w 0+32e <[^>]+>
290-0+3ba <[^>]+> f2c0 8014 blt\.w 0+3e6 <[^>]+>
291-0+3be <[^>]+> f73f afb6 bgt\.w 0+32e <[^>]+>
292-0+3c2 <[^>]+> f300 8010 bgt\.w 0+3e6 <[^>]+>
293-0+3c6 <[^>]+> f77f afb2 ble\.w 0+32e <[^>]+>
294-0+3ca <[^>]+> f340 800c ble\.w 0+3e6 <[^>]+>
295-0+3ce <[^>]+> f7ff bfae b\.w 0+32e <[^>]+>
296-0+3d2 <[^>]+> f000 b808 b\.w 0+3e6 <[^>]+>
297-0+3d6 <[^>]+> f000 f995 bl 0+32e <[^>]+>
298- 3d6: R_ARM_THM_CALL \.text
299-0+3da <[^>]+> f000 f9f1 bl 0+3e6 <[^>]+>
300- 3da: R_ARM_THM_CALL \.text
301-0+3de <[^>]+> f000 e995 blx 0+32e <[^>]+>
302- 3de: R_ARM_THM_XPC22 \.text
303-0+3e2 <[^>]+> f000 e9f1 blx 0+3e6 <[^>]+>
304- 3e2: R_ARM_THM_XPC22 \.text
305-0+3e6 <[^>]+> 4700 bx r0
254+0+32c <[^>]+> e000 b\.n 0+330 <[^>]+>
255+0+32e <[^>]+> 46c0 nop \(mov r8, r8\)
256+0+330 <[^>]+> f43f affe beq\.w 0+330 <[^>]+>
257+0+334 <[^>]+> f000 8058 beq\.w 0+3e8 <[^>]+>
258+0+338 <[^>]+> f47f affa bne\.w 0+330 <[^>]+>
259+0+33c <[^>]+> f040 8054 bne\.w 0+3e8 <[^>]+>
260+0+340 <[^>]+> f4bf aff6 bcs\.w 0+330 <[^>]+>
261+0+344 <[^>]+> f080 8050 bcs\.w 0+3e8 <[^>]+>
262+0+348 <[^>]+> f4bf aff2 bcs\.w 0+330 <[^>]+>
263+0+34c <[^>]+> f080 804c bcs\.w 0+3e8 <[^>]+>
264+0+350 <[^>]+> f4ff afee bcc\.w 0+330 <[^>]+>
265+0+354 <[^>]+> f0c0 8048 bcc\.w 0+3e8 <[^>]+>
266+0+358 <[^>]+> f4ff afea bcc\.w 0+330 <[^>]+>
267+0+35c <[^>]+> f0c0 8044 bcc\.w 0+3e8 <[^>]+>
268+0+360 <[^>]+> f4ff afe6 bcc\.w 0+330 <[^>]+>
269+0+364 <[^>]+> f0c0 8040 bcc\.w 0+3e8 <[^>]+>
270+0+368 <[^>]+> f53f afe2 bmi\.w 0+330 <[^>]+>
271+0+36c <[^>]+> f100 803c bmi\.w 0+3e8 <[^>]+>
272+0+370 <[^>]+> f57f afde bpl\.w 0+330 <[^>]+>
273+0+374 <[^>]+> f140 8038 bpl\.w 0+3e8 <[^>]+>
274+0+378 <[^>]+> f5bf afda bvs\.w 0+330 <[^>]+>
275+0+37c <[^>]+> f180 8034 bvs\.w 0+3e8 <[^>]+>
276+0+380 <[^>]+> f5ff afd6 bvc\.w 0+330 <[^>]+>
277+0+384 <[^>]+> f1c0 8030 bvc\.w 0+3e8 <[^>]+>
278+0+388 <[^>]+> f63f afd2 bhi\.w 0+330 <[^>]+>
279+0+38c <[^>]+> f200 802c bhi\.w 0+3e8 <[^>]+>
280+0+390 <[^>]+> f67f afce bls\.w 0+330 <[^>]+>
281+0+394 <[^>]+> f240 8028 bls\.w 0+3e8 <[^>]+>
282+0+398 <[^>]+> f5ff afca bvc\.w 0+330 <[^>]+>
283+0+39c <[^>]+> f1c0 8024 bvc\.w 0+3e8 <[^>]+>
284+0+3a0 <[^>]+> f63f afc6 bhi\.w 0+330 <[^>]+>
285+0+3a4 <[^>]+> f200 8020 bhi\.w 0+3e8 <[^>]+>
286+0+3a8 <[^>]+> f67f afc2 bls\.w 0+330 <[^>]+>
287+0+3ac <[^>]+> f240 801c bls\.w 0+3e8 <[^>]+>
288+0+3b0 <[^>]+> f6bf afbe bge\.w 0+330 <[^>]+>
289+0+3b4 <[^>]+> f280 8018 bge\.w 0+3e8 <[^>]+>
290+0+3b8 <[^>]+> f6ff afba blt\.w 0+330 <[^>]+>
291+0+3bc <[^>]+> f2c0 8014 blt\.w 0+3e8 <[^>]+>
292+0+3c0 <[^>]+> f73f afb6 bgt\.w 0+330 <[^>]+>
293+0+3c4 <[^>]+> f300 8010 bgt\.w 0+3e8 <[^>]+>
294+0+3c8 <[^>]+> f77f afb2 ble\.w 0+330 <[^>]+>
295+0+3cc <[^>]+> f340 800c ble\.w 0+3e8 <[^>]+>
296+0+3d0 <[^>]+> f7ff bfae b\.w 0+330 <[^>]+>
297+0+3d4 <[^>]+> f000 b808 b\.w 0+3e8 <[^>]+>
298+0+3d8 <[^>]+> f000 f996 bl 0+330 <[^>]+>
299+ 3d8: R_ARM_THM_CALL \.text
300+0+3dc <[^>]+> f000 f9f2 bl 0+3e8 <[^>]+>
301+ 3dc: R_ARM_THM_CALL \.text
302+0+3e0 <[^>]+> f000 e996 blx 0+330 <[^>]+>
303+ 3e0: R_ARM_THM_XPC22 \.text
304+0+3e4 <[^>]+> f000 e9f2 blx 0+3e8 <[^>]+>
305+ 3e4: R_ARM_THM_XPC22 \.text
306306 0+3e8 <[^>]+> 4748 bx r9
307307 0+3ea <[^>]+> 4780 blx r0
308308 0+3ec <[^>]+> 47c8 blx r9
@@ -508,8 +508,8 @@ Disassembly of section .text:
508508 0+5b2 <[^>]+> f815 1d30 ldrb\.w r1, \[r5\], #-48
509509 0+5b6 <[^>]+> 5d29 ldrb r1, \[r5, r4\]
510510 0+5b8 <[^>]+> f819 100c ldrb\.w r1, \[r9, ip\]
511-0+5bc <[^>]+> f89f 10b0 ldrb\.w r1, \[pc, #176\]
512-0+5c0 <[^>]+> f81f 1c26 ldrb\.w r1, \[pc, #-3110\]
511+0+5bc <[^>]+> f89f 10ac ldrb\.w r1, \[pc, #172\] ; 0+66c <[^>]+>
512+0+5c0 <[^>]+> f81f 102a ldrb\.w r1, \[pc, #-42\] ; 0+59a <[^>]+>
513513 0+5c4 <[^>]+> f995 1000 ldrsb\.w r1, \[r5\]
514514 0+5c8 <[^>]+> f995 1330 ldrsb\.w r1, \[r5, #816\]
515515 0+5cc <[^>]+> f915 1c30 ldrsb\.w r1, \[r5, #-48\]
@@ -519,8 +519,8 @@ Disassembly of section .text:
519519 0+5dc <[^>]+> f915 1d30 ldrsb\.w r1, \[r5\], #-48
520520 0+5e0 <[^>]+> 5729 ldrsb r1, \[r5, r4\]
521521 0+5e2 <[^>]+> f919 100c ldrsb\.w r1, \[r9, ip\]
522-0+5e6 <[^>]+> f99f 1086 ldrsb\.w r1, \[pc, #134\]
523-0+5ea <[^>]+> f91f 1c50 ldrsb\.w r1, \[pc, #-3152\]
522+0+5e6 <[^>]+> f99f 1084 ldrsb\.w r1, \[pc, #132\] ; 0+66c <[^>]+>
523+0+5ea <[^>]+> f91f 1052 ldrsb\.w r1, \[pc, #-82\] ; 0+59a <[^>]+>
524524 0+5ee <[^>]+> f8b5 1000 ldrh\.w r1, \[r5\]
525525 0+5f2 <[^>]+> f8b5 1330 ldrh\.w r1, \[r5, #816\]
526526 0+5f6 <[^>]+> f835 1c30 ldrh\.w r1, \[r5, #-48\]
@@ -530,8 +530,8 @@ Disassembly of section .text:
530530 0+606 <[^>]+> f835 1d30 ldrh\.w r1, \[r5\], #-48
531531 0+60a <[^>]+> 5b29 ldrh r1, \[r5, r4\]
532532 0+60c <[^>]+> f839 100c ldrh\.w r1, \[r9, ip\]
533-0+610 <[^>]+> f8bf 105c ldrh\.w r1, \[pc, #92\]
534-0+614 <[^>]+> f83f 1c7a ldrh\.w r1, \[pc, #-3194\]
533+0+610 <[^>]+> f8bf 1058 ldrh\.w r1, \[pc, #88\] ; 0+66c <[^>]+>
534+0+614 <[^>]+> f83f 107e ldrh\.w r1, \[pc, #-126\] ; 0+59a <[^>]+>
535535 0+618 <[^>]+> f9b5 1000 ldrsh\.w r1, \[r5\]
536536 0+61c <[^>]+> f9b5 1330 ldrsh\.w r1, \[r5, #816\]
537537 0+620 <[^>]+> f935 1c30 ldrsh\.w r1, \[r5, #-48\]
@@ -541,8 +541,8 @@ Disassembly of section .text:
541541 0+630 <[^>]+> f935 1d30 ldrsh\.w r1, \[r5\], #-48
542542 0+634 <[^>]+> 5f29 ldrsh r1, \[r5, r4\]
543543 0+636 <[^>]+> f939 100c ldrsh\.w r1, \[r9, ip\]
544-0+63a <[^>]+> f9bf 1032 ldrsh\.w r1, \[pc, #50\]
545-0+63e <[^>]+> f93f 1ca4 ldrsh\.w r1, \[pc, #-3236\]
544+0+63a <[^>]+> f9bf 1030 ldrsh\.w r1, \[pc, #48\] ; 0+66c <[^>]+>
545+0+63e <[^>]+> f93f 10a6 ldrsh\.w r1, \[pc, #-166\] ; 0+59a <[^>]+>
546546 0+642 <[^>]+> f8d5 1000 ldr\.w r1, \[r5\]
547547 0+646 <[^>]+> f8d5 1330 ldr\.w r1, \[r5, #816\]
548548 0+64a <[^>]+> f855 1c30 ldr\.w r1, \[r5, #-48\]
@@ -552,8 +552,8 @@ Disassembly of section .text:
552552 0+65a <[^>]+> f855 1d30 ldr\.w r1, \[r5\], #-48
553553 0+65e <[^>]+> 5929 ldr r1, \[r5, r4\]
554554 0+660 <[^>]+> f859 100c ldr\.w r1, \[r9, ip\]
555-0+664 <[^>]+> f8df 1008 ldr\.w r1, \[pc, #8\]
556-0+668 <[^>]+> f85f 1cce ldr\.w r1, \[pc, #-3278\]
555+0+664 <[^>]+> f8df 1004 ldr\.w r1, \[pc, #4\] ; 0+66c <[^>]+>
556+0+668 <[^>]+> f85f 10d2 ldr\.w r1, \[pc, #-210\] ; 0+59a <[^>]+>
557557 0+66c <[^>]+> f885 1000 strb\.w r1, \[r5\]
558558 0+670 <[^>]+> f885 1330 strb\.w r1, \[r5, #816\]
559559 0+674 <[^>]+> f805 1c30 strb\.w r1, \[r5, #-48\]
@@ -563,8 +563,8 @@ Disassembly of section .text:
563563 0+684 <[^>]+> f805 1d30 strb\.w r1, \[r5\], #-48
564564 0+688 <[^>]+> 5529 strb r1, \[r5, r4\]
565565 0+68a <[^>]+> f809 100c strb\.w r1, \[r9, ip\]
566-0+68e <[^>]+> f88f 1088 strb\.w r1, \[pc, #136\]
567-0+692 <[^>]+> f80f 1c26 strb\.w r1, \[pc, #-3110\]
566+0+68e <[^>]+> f88f 1086 strb\.w r1, \[pc, #134\] ; 0+716 <[^>]+>
567+0+692 <[^>]+> f80f 1028 strb\.w r1, \[pc, #-40\] ; 0+66c <[^>]+>
568568 0+696 <[^>]+> f8a5 1000 strh\.w r1, \[r5\]
569569 0+69a <[^>]+> f8a5 1330 strh\.w r1, \[r5, #816\]
570570 0+69e <[^>]+> f825 1c30 strh\.w r1, \[r5, #-48\]
@@ -574,8 +574,8 @@ Disassembly of section .text:
574574 0+6ae <[^>]+> f825 1d30 strh\.w r1, \[r5\], #-48
575575 0+6b2 <[^>]+> 5329 strh r1, \[r5, r4\]
576576 0+6b4 <[^>]+> f829 100c strh\.w r1, \[r9, ip\]
577-0+6b8 <[^>]+> f8af 105e strh\.w r1, \[pc, #94\]
578-0+6bc <[^>]+> f82f 1c50 strh\.w r1, \[pc, #-3152\]
577+0+6b8 <[^>]+> f8af 105a strh\.w r1, \[pc, #90\] ; 0+716 <[^>]+>
578+0+6bc <[^>]+> f82f 1054 strh\.w r1, \[pc, #-84\] ; 0+66c <[^>]+>
579579 0+6c0 <[^>]+> f8c5 1000 str\.w r1, \[r5\]
580580 0+6c4 <[^>]+> f8c5 1330 str\.w r1, \[r5, #816\]
581581 0+6c8 <[^>]+> f845 1c30 str\.w r1, \[r5, #-48\]
@@ -585,8 +585,8 @@ Disassembly of section .text:
585585 0+6d8 <[^>]+> f845 1d30 str\.w r1, \[r5\], #-48
586586 0+6dc <[^>]+> 5129 str r1, \[r5, r4\]
587587 0+6de <[^>]+> f849 100c str\.w r1, \[r9, ip\]
588-0+6e2 <[^>]+> f8cf 1034 str\.w r1, \[pc, #52\]
589-0+6e6 <[^>]+> f84f 1c7a str\.w r1, \[pc, #-3194\]
588+0+6e2 <[^>]+> f8cf 1032 str\.w r1, \[pc, #50\] ; 0+716 <[^>]+>
589+0+6e6 <[^>]+> f84f 107c str\.w r1, \[pc, #-124\] ; 0+66c <[^>]+>
590590 0+6ea <[^>]+> f895 f000 pld \[r5\]
591591 0+6ee <[^>]+> f895 f330 pld \[r5, #816\]
592592 0+6f2 <[^>]+> f815 fc30 pld \[r5, #-48\]
@@ -596,8 +596,8 @@ Disassembly of section .text:
596596 0+702 <[^>]+> f815 fd30 pld \[r5\], #-48
597597 0+706 <[^>]+> f815 f000 pld \[r5, r0\]
598598 0+70a <[^>]+> f819 f000 pld \[r9, r0\]
599-0+70e <[^>]+> f89f f008 pld \[pc, #8\]
600-0+712 <[^>]+> f81f fca6 pld \[pc, #-3238\]
599+0+70e <[^>]+> f89f f006 pld \[pc, #6\] ; 0+716 <[^>]+>
600+0+712 <[^>]+> f81f f0a8 pld \[pc, #-168\] ; 0+66c <[^>]+>
601601 0+716 <[^>]+> e9d5 2300 ldrd r2, r3, \[r5\]
602602 0+71a <[^>]+> e9d5 230c ldrd r2, r3, \[r5, #48\]
603603 0+71e <[^>]+> e955 230c ldrd r2, r3, \[r5, #-48\]
--- a/gas/testsuite/gas/arm/thumb32.s
+++ b/gas/testsuite/gas/arm/thumb32.s
@@ -194,6 +194,7 @@ branches:
194194 bra bal.n
195195 bra b.n
196196 @ bl, blx have no short form.
197+ .balign 4
197198 1:
198199 bra beq
199200 bra bne
@@ -218,9 +219,8 @@ branches:
218219 bra b
219220 bra bl
220221 bra blx
222+ .balign 4
221223 1:
222-
223- bx r0
224224 bx r9
225225 blx r0
226226 blx r9
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -2278,61 +2278,75 @@ print_insn_thumb32 (pc, info, given)
22782278 unsigned int op = (given & 0x00000f00) >> 8;
22792279 unsigned int i12 = (given & 0x00000fff);
22802280 unsigned int i8 = (given & 0x000000ff);
2281+ bfd_boolean writeback = FALSE, postind = FALSE;
2282+ int offset = 0;
22812283
22822284 func (stream, "[%s", arm_regnames[Rn]);
22832285 if (U) /* 12-bit positive immediate offset */
2286+ offset = i12;
2287+ else if (Rn == 15) /* 12-bit negative immediate offset */
2288+ offset = -(int)i12;
2289+ else if (op == 0x0) /* shifted register offset */
22842290 {
2285- if (i12)
2286- func (stream, ", #%u", i12);
2291+ unsigned int Rm = (i8 & 0x0f);
2292+ unsigned int sh = (i8 & 0x30) >> 4;
2293+ func (stream, ", %s", arm_regnames[Rm]);
2294+ if (sh)
2295+ func (stream, ", lsl #%u", sh);
22872296 func (stream, "]");
2297+ break;
22882298 }
2289- else if (Rn == 15) /* 12-bit negative immediate offset */
2290- func (stream, ", #-%u]", i12);
22912299 else switch (op)
22922300 {
2293- case 0x0: /* shifted register offset */
2294- {
2295- unsigned int Rm = (i8 & 0x0f);
2296- unsigned int sh = (i8 & 0x30) >> 4;
2297- func (stream, ", %s", arm_regnames[Rm]);
2298- if (sh)
2299- func (stream, ", lsl #%u", sh);
2300- func (stream, "]");
2301- }
2302- break;
2303-
23042301 case 0xE: /* 8-bit positive immediate offset */
2305- if (i8)
2306- func (stream, ", #%u", i8);
2307- func (stream, "]");
2302+ offset = i8;
23082303 break;
23092304
23102305 case 0xC: /* 8-bit negative immediate offset */
2311- func (stream, ", #-%u]", i8);
2306+ offset = -i8;
23122307 break;
23132308
23142309 case 0xB: /* 8-bit + preindex with wb */
2315- if (i8)
2316- func (stream, ", #%u", i8);
2317- func (stream, "]!");
2310+ offset = i8;
2311+ writeback = TRUE;
23182312 break;
23192313
23202314 case 0x9: /* 8-bit - preindex with wb */
2321- func (stream, ", #-%u]!", i8);
2315+ offset = -i8;
2316+ writeback = TRUE;
23222317 break;
23232318
23242319 case 0xF: /* 8-bit + postindex */
2325- func (stream, "], #%u", i8);
2320+ offset = i8;
2321+ postind = TRUE;
23262322 break;
23272323
23282324 case 0xD: /* 8-bit - postindex */
2329- func (stream, "], #-%u", i8);
2325+ offset = -i8;
2326+ postind = TRUE;
23302327 break;
23312328
23322329 default:
23332330 func (stream, ", <undefined>]");
2331+ goto skip;
2332+ }
2333+
2334+ if (postind)
2335+ func (stream, "], #%d", offset);
2336+ else
2337+ {
2338+ if (offset)
2339+ func (stream, ", #%d", offset);
2340+ func (stream, writeback ? "]!" : "]");
2341+ }
2342+
2343+ if (Rn == 15)
2344+ {
2345+ func (stream, "\t; ");
2346+ info->print_address_func (((pc + 4) & ~3) + offset, info);
23342347 }
23352348 }
2349+ skip:
23362350 break;
23372351
23382352 case 'A':
@@ -2425,7 +2439,7 @@ print_insn_thumb32 (pc, info, given)
24252439 unsigned int S = (given & 0x04000000u) >> 26;
24262440 unsigned int J1 = (given & 0x00002000u) >> 13;
24272441 unsigned int J2 = (given & 0x00000800u) >> 11;
2428- unsigned int offset = 0;
2442+ int offset = 0;
24292443
24302444 offset |= !S << 20;
24312445 offset |= J2 << 19;
@@ -2434,7 +2448,7 @@ print_insn_thumb32 (pc, info, given)
24342448 offset |= (given & 0x000007ff) << 1;
24352449 offset -= (1 << 20);
24362450
2437- info->print_address_func ((bfd_vma)offset + pc + 4, info);
2451+ info->print_address_func (pc + 4 + offset, info);
24382452 }
24392453 break;
24402454
@@ -2443,7 +2457,7 @@ print_insn_thumb32 (pc, info, given)
24432457 unsigned int S = (given & 0x04000000u) >> 26;
24442458 unsigned int I1 = (given & 0x00002000u) >> 13;
24452459 unsigned int I2 = (given & 0x00000800u) >> 11;
2446- unsigned int offset = 0;
2460+ int offset = 0;
24472461
24482462 offset |= !S << 24;
24492463 offset |= !(I1 ^ S) << 23;
@@ -2452,7 +2466,7 @@ print_insn_thumb32 (pc, info, given)
24522466 offset |= (given & 0x000007ffu) << 1;
24532467 offset -= (1 << 24);
24542468
2455- info->print_address_func ((bfd_vma)offset + pc + 4, info);
2469+ info->print_address_func (pc + 4 + offset, info);
24562470 }
24572471 break;
24582472