GNU Binutils with patches for OS216
修订版 | 0e8142adb1dfe1acbe8c71a70d8fb002b2f60243 (tree) |
---|---|
时间 | 2005-05-01 08:36:15 |
作者 | Paul Brook <paul@code...> |
Commiter | Paul Brook |
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.
@@ -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 | + | |
1 | 32 | 2005-04-29 Zack Weinberg <zack@codesourcery.com> |
2 | 33 | |
3 | 34 | * gas/sb.c: Include as.h. |
@@ -5639,6 +5639,7 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d) | ||
5639 | 5639 | inst.instruction |= 0x00000100; |
5640 | 5640 | } |
5641 | 5641 | inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_IMM; |
5642 | + inst.reloc.pc_rel = is_pc; | |
5642 | 5643 | } |
5643 | 5644 | else if (inst.operands[i].postind) |
5644 | 5645 | { |
@@ -5672,7 +5673,6 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d) | ||
5672 | 5673 | X(asrs, 1000, fa50f000), \ |
5673 | 5674 | X(bic, 4380, ea200000), \ |
5674 | 5675 | X(bics, 4380, ea300000), \ |
5675 | - X(blx, 4780, f000c000), \ | |
5676 | 5676 | X(cmn, 42c0, eb100f00), \ |
5677 | 5677 | X(cmp, 2800, ebb00f00), \ |
5678 | 5678 | X(cpsie, b660, f3af8400), \ |
@@ -6454,8 +6454,6 @@ do_t_ldst (void) | ||
6454 | 6454 | |
6455 | 6455 | inst.instruction |= inst.operands[0].reg << 8; |
6456 | 6456 | inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; |
6457 | - if (inst.reloc.pc_rel) | |
6458 | - inst.reloc.exp.X_add_number -= 4; /* pipeline offset */ | |
6459 | 6457 | return; |
6460 | 6458 | } |
6461 | 6459 |
@@ -9664,12 +9662,21 @@ md_pcrel_from (fixS * fixP) | ||
9664 | 9662 | && fixP->fx_subsy == NULL) |
9665 | 9663 | return 0; |
9666 | 9664 | |
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) | |
9668 | 9670 | { |
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: | |
9672 | 9672 | 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; | |
9673 | 9680 | } |
9674 | 9681 | |
9675 | 9682 | #ifdef TE_WINCE |
@@ -9866,7 +9873,7 @@ md_apply_fix3 (fixS * fixP, | ||
9866 | 9873 | |
9867 | 9874 | /* If this symbol is in a different section then we need to leave it for |
9868 | 9875 | 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. */ | |
9870 | 9877 | if (fixP->fx_pcrel) |
9871 | 9878 | { |
9872 | 9879 | if (fixP->fx_addsy != NULL |
@@ -10073,7 +10080,7 @@ md_apply_fix3 (fixS * fixP, | ||
10073 | 10080 | } |
10074 | 10081 | newval &= ~0xff; |
10075 | 10082 | } |
10076 | - else if ((newval & 0x0000f000) == 0x0000f0000) | |
10083 | + else if ((newval & 0x000f0000) == 0x000f0000) | |
10077 | 10084 | { |
10078 | 10085 | /* PC-relative, 12-bit offset. */ |
10079 | 10086 | if (value >= 0) |
@@ -10680,24 +10687,20 @@ md_apply_fix3 (fixS * fixP, | ||
10680 | 10687 | { |
10681 | 10688 | case 4: /* PC load. */ |
10682 | 10689 | /* 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. */ | |
10688 | 10692 | if (value & 3) |
10689 | 10693 | as_bad_where (fixP->fx_file, fixP->fx_line, |
10690 | 10694 | _("invalid offset, target not word aligned (0x%08lX)"), |
10691 | 10695 | (((unsigned int) fixP->fx_frag->fr_address |
10692 | 10696 | + (unsigned int) fixP->fx_where) & ~3) + value); |
10693 | 10697 | |
10694 | - if ((value + 2) & ~0x3fe) | |
10698 | + if (value & ~0x3fc) | |
10695 | 10699 | as_bad_where (fixP->fx_file, fixP->fx_line, |
10696 | 10700 | _("invalid offset, value too big (0x%08lX)"), |
10697 | 10701 | (long) value); |
10698 | 10702 | |
10699 | - /* Round up, since pc will be rounded down. */ | |
10700 | - newval |= (value + 2) >> 2; | |
10703 | + newval |= value >> 2; | |
10701 | 10704 | break; |
10702 | 10705 | |
10703 | 10706 | case 9: /* SP load/store. */ |
@@ -7,3 +7,6 @@ | ||
7 | 7 | Disassembly of section .text: |
8 | 8 | |
9 | 9 | 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\) |
@@ -3,4 +3,10 @@ | ||
3 | 3 | ldmia sp!, {\regs, pc} |
4 | 4 | .endm |
5 | 5 | .text |
6 | +l: | |
6 | 7 | popret "r4, r5" |
8 | + | |
9 | + @ section padding for a.out's sake | |
10 | + nop | |
11 | + nop | |
12 | + nop |
@@ -20,3 +20,7 @@ Disassembly of section .text: | ||
20 | 20 | 0+12 <[^>]*> 4308 * orrs r0, r1 |
21 | 21 | 0+14 <[^>]*> 4388 * bics r0, r1 |
22 | 22 | 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\) |
@@ -25,3 +25,8 @@ m: | ||
25 | 25 | |
26 | 26 | sbc r0,r0,r1 |
27 | 27 | |
28 | + @ section padding for a.out's sake | |
29 | + nop | |
30 | + nop | |
31 | + nop | |
32 | + nop |
@@ -181,3 +181,9 @@ Disassembly of section \.text: | ||
181 | 181 | \.\.\. |
182 | 182 | 0+938 <[^>]+> f000 f898 bl 0+134 <[^>]+> |
183 | 183 | 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\) |
@@ -192,3 +192,11 @@ forwardonly: | ||
192 | 192 | .space (1 << 11) @ leave space to force long offsets |
193 | 193 | .local: |
194 | 194 | 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 |
@@ -209,100 +209,100 @@ Disassembly of section .text: | ||
209 | 209 | 0+2ce <[^>]+> f3c0 5040 ubfx r0, r0, #21, #1 |
210 | 210 | 0+2d2 <[^>]+> f340 0011 sbfx r0, r0, #0, #18 |
211 | 211 | 0+2d6 <[^>]+> d0fe beq\.n 0+2d6 <[^>]+> |
212 | -0+2d8 <[^>]+> d029 beq\.n 0+32e <[^>]+> | |
212 | +0+2d8 <[^>]+> d02a beq\.n 0+330 <[^>]+> | |
213 | 213 | 0+2da <[^>]+> d1fc bne\.n 0+2d6 <[^>]+> |
214 | -0+2dc <[^>]+> d127 bne\.n 0+32e <[^>]+> | |
214 | +0+2dc <[^>]+> d128 bne\.n 0+330 <[^>]+> | |
215 | 215 | 0+2de <[^>]+> d2fa bcs\.n 0+2d6 <[^>]+> |
216 | -0+2e0 <[^>]+> d225 bcs\.n 0+32e <[^>]+> | |
216 | +0+2e0 <[^>]+> d226 bcs\.n 0+330 <[^>]+> | |
217 | 217 | 0+2e2 <[^>]+> d2f8 bcs\.n 0+2d6 <[^>]+> |
218 | -0+2e4 <[^>]+> d223 bcs\.n 0+32e <[^>]+> | |
218 | +0+2e4 <[^>]+> d224 bcs\.n 0+330 <[^>]+> | |
219 | 219 | 0+2e6 <[^>]+> d3f6 bcc\.n 0+2d6 <[^>]+> |
220 | -0+2e8 <[^>]+> d321 bcc\.n 0+32e <[^>]+> | |
220 | +0+2e8 <[^>]+> d322 bcc\.n 0+330 <[^>]+> | |
221 | 221 | 0+2ea <[^>]+> d3f4 bcc\.n 0+2d6 <[^>]+> |
222 | -0+2ec <[^>]+> d31f bcc\.n 0+32e <[^>]+> | |
222 | +0+2ec <[^>]+> d320 bcc\.n 0+330 <[^>]+> | |
223 | 223 | 0+2ee <[^>]+> d3f2 bcc\.n 0+2d6 <[^>]+> |
224 | -0+2f0 <[^>]+> d31d bcc\.n 0+32e <[^>]+> | |
224 | +0+2f0 <[^>]+> d31e bcc\.n 0+330 <[^>]+> | |
225 | 225 | 0+2f2 <[^>]+> d4f0 bmi\.n 0+2d6 <[^>]+> |
226 | -0+2f4 <[^>]+> d41b bmi\.n 0+32e <[^>]+> | |
226 | +0+2f4 <[^>]+> d41c bmi\.n 0+330 <[^>]+> | |
227 | 227 | 0+2f6 <[^>]+> d5ee bpl\.n 0+2d6 <[^>]+> |
228 | -0+2f8 <[^>]+> d519 bpl\.n 0+32e <[^>]+> | |
228 | +0+2f8 <[^>]+> d51a bpl\.n 0+330 <[^>]+> | |
229 | 229 | 0+2fa <[^>]+> d6ec bvs\.n 0+2d6 <[^>]+> |
230 | -0+2fc <[^>]+> d617 bvs\.n 0+32e <[^>]+> | |
230 | +0+2fc <[^>]+> d618 bvs\.n 0+330 <[^>]+> | |
231 | 231 | 0+2fe <[^>]+> d7ea bvc\.n 0+2d6 <[^>]+> |
232 | -0+300 <[^>]+> d715 bvc\.n 0+32e <[^>]+> | |
232 | +0+300 <[^>]+> d716 bvc\.n 0+330 <[^>]+> | |
233 | 233 | 0+302 <[^>]+> d8e8 bhi\.n 0+2d6 <[^>]+> |
234 | -0+304 <[^>]+> d813 bhi\.n 0+32e <[^>]+> | |
234 | +0+304 <[^>]+> d814 bhi\.n 0+330 <[^>]+> | |
235 | 235 | 0+306 <[^>]+> d9e6 bls\.n 0+2d6 <[^>]+> |
236 | -0+308 <[^>]+> d911 bls\.n 0+32e <[^>]+> | |
236 | +0+308 <[^>]+> d912 bls\.n 0+330 <[^>]+> | |
237 | 237 | 0+30a <[^>]+> d7e4 bvc\.n 0+2d6 <[^>]+> |
238 | -0+30c <[^>]+> d70f bvc\.n 0+32e <[^>]+> | |
238 | +0+30c <[^>]+> d710 bvc\.n 0+330 <[^>]+> | |
239 | 239 | 0+30e <[^>]+> d8e2 bhi\.n 0+2d6 <[^>]+> |
240 | -0+310 <[^>]+> d80d bhi\.n 0+32e <[^>]+> | |
240 | +0+310 <[^>]+> d80e bhi\.n 0+330 <[^>]+> | |
241 | 241 | 0+312 <[^>]+> d9e0 bls\.n 0+2d6 <[^>]+> |
242 | -0+314 <[^>]+> d90b bls\.n 0+32e <[^>]+> | |
242 | +0+314 <[^>]+> d90c bls\.n 0+330 <[^>]+> | |
243 | 243 | 0+316 <[^>]+> dade bge\.n 0+2d6 <[^>]+> |
244 | -0+318 <[^>]+> da09 bge\.n 0+32e <[^>]+> | |
244 | +0+318 <[^>]+> da0a bge\.n 0+330 <[^>]+> | |
245 | 245 | 0+31a <[^>]+> dbdc blt\.n 0+2d6 <[^>]+> |
246 | -0+31c <[^>]+> db07 blt\.n 0+32e <[^>]+> | |
246 | +0+31c <[^>]+> db08 blt\.n 0+330 <[^>]+> | |
247 | 247 | 0+31e <[^>]+> dcda bgt\.n 0+2d6 <[^>]+> |
248 | -0+320 <[^>]+> dc05 bgt\.n 0+32e <[^>]+> | |
248 | +0+320 <[^>]+> dc06 bgt\.n 0+330 <[^>]+> | |
249 | 249 | 0+322 <[^>]+> ddd8 ble\.n 0+2d6 <[^>]+> |
250 | -0+324 <[^>]+> dd03 ble\.n 0+32e <[^>]+> | |
250 | +0+324 <[^>]+> dd04 ble\.n 0+330 <[^>]+> | |
251 | 251 | 0+326 <[^>]+> ded6 bal\.n 0+2d6 <[^>]+> |
252 | -0+328 <[^>]+> de01 bal\.n 0+32e <[^>]+> | |
252 | +0+328 <[^>]+> de02 bal\.n 0+330 <[^>]+> | |
253 | 253 | 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 | |
306 | 306 | 0+3e8 <[^>]+> 4748 bx r9 |
307 | 307 | 0+3ea <[^>]+> 4780 blx r0 |
308 | 308 | 0+3ec <[^>]+> 47c8 blx r9 |
@@ -508,8 +508,8 @@ Disassembly of section .text: | ||
508 | 508 | 0+5b2 <[^>]+> f815 1d30 ldrb\.w r1, \[r5\], #-48 |
509 | 509 | 0+5b6 <[^>]+> 5d29 ldrb r1, \[r5, r4\] |
510 | 510 | 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 <[^>]+> | |
513 | 513 | 0+5c4 <[^>]+> f995 1000 ldrsb\.w r1, \[r5\] |
514 | 514 | 0+5c8 <[^>]+> f995 1330 ldrsb\.w r1, \[r5, #816\] |
515 | 515 | 0+5cc <[^>]+> f915 1c30 ldrsb\.w r1, \[r5, #-48\] |
@@ -519,8 +519,8 @@ Disassembly of section .text: | ||
519 | 519 | 0+5dc <[^>]+> f915 1d30 ldrsb\.w r1, \[r5\], #-48 |
520 | 520 | 0+5e0 <[^>]+> 5729 ldrsb r1, \[r5, r4\] |
521 | 521 | 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 <[^>]+> | |
524 | 524 | 0+5ee <[^>]+> f8b5 1000 ldrh\.w r1, \[r5\] |
525 | 525 | 0+5f2 <[^>]+> f8b5 1330 ldrh\.w r1, \[r5, #816\] |
526 | 526 | 0+5f6 <[^>]+> f835 1c30 ldrh\.w r1, \[r5, #-48\] |
@@ -530,8 +530,8 @@ Disassembly of section .text: | ||
530 | 530 | 0+606 <[^>]+> f835 1d30 ldrh\.w r1, \[r5\], #-48 |
531 | 531 | 0+60a <[^>]+> 5b29 ldrh r1, \[r5, r4\] |
532 | 532 | 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 <[^>]+> | |
535 | 535 | 0+618 <[^>]+> f9b5 1000 ldrsh\.w r1, \[r5\] |
536 | 536 | 0+61c <[^>]+> f9b5 1330 ldrsh\.w r1, \[r5, #816\] |
537 | 537 | 0+620 <[^>]+> f935 1c30 ldrsh\.w r1, \[r5, #-48\] |
@@ -541,8 +541,8 @@ Disassembly of section .text: | ||
541 | 541 | 0+630 <[^>]+> f935 1d30 ldrsh\.w r1, \[r5\], #-48 |
542 | 542 | 0+634 <[^>]+> 5f29 ldrsh r1, \[r5, r4\] |
543 | 543 | 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 <[^>]+> | |
546 | 546 | 0+642 <[^>]+> f8d5 1000 ldr\.w r1, \[r5\] |
547 | 547 | 0+646 <[^>]+> f8d5 1330 ldr\.w r1, \[r5, #816\] |
548 | 548 | 0+64a <[^>]+> f855 1c30 ldr\.w r1, \[r5, #-48\] |
@@ -552,8 +552,8 @@ Disassembly of section .text: | ||
552 | 552 | 0+65a <[^>]+> f855 1d30 ldr\.w r1, \[r5\], #-48 |
553 | 553 | 0+65e <[^>]+> 5929 ldr r1, \[r5, r4\] |
554 | 554 | 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 <[^>]+> | |
557 | 557 | 0+66c <[^>]+> f885 1000 strb\.w r1, \[r5\] |
558 | 558 | 0+670 <[^>]+> f885 1330 strb\.w r1, \[r5, #816\] |
559 | 559 | 0+674 <[^>]+> f805 1c30 strb\.w r1, \[r5, #-48\] |
@@ -563,8 +563,8 @@ Disassembly of section .text: | ||
563 | 563 | 0+684 <[^>]+> f805 1d30 strb\.w r1, \[r5\], #-48 |
564 | 564 | 0+688 <[^>]+> 5529 strb r1, \[r5, r4\] |
565 | 565 | 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 <[^>]+> | |
568 | 568 | 0+696 <[^>]+> f8a5 1000 strh\.w r1, \[r5\] |
569 | 569 | 0+69a <[^>]+> f8a5 1330 strh\.w r1, \[r5, #816\] |
570 | 570 | 0+69e <[^>]+> f825 1c30 strh\.w r1, \[r5, #-48\] |
@@ -574,8 +574,8 @@ Disassembly of section .text: | ||
574 | 574 | 0+6ae <[^>]+> f825 1d30 strh\.w r1, \[r5\], #-48 |
575 | 575 | 0+6b2 <[^>]+> 5329 strh r1, \[r5, r4\] |
576 | 576 | 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 <[^>]+> | |
579 | 579 | 0+6c0 <[^>]+> f8c5 1000 str\.w r1, \[r5\] |
580 | 580 | 0+6c4 <[^>]+> f8c5 1330 str\.w r1, \[r5, #816\] |
581 | 581 | 0+6c8 <[^>]+> f845 1c30 str\.w r1, \[r5, #-48\] |
@@ -585,8 +585,8 @@ Disassembly of section .text: | ||
585 | 585 | 0+6d8 <[^>]+> f845 1d30 str\.w r1, \[r5\], #-48 |
586 | 586 | 0+6dc <[^>]+> 5129 str r1, \[r5, r4\] |
587 | 587 | 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 <[^>]+> | |
590 | 590 | 0+6ea <[^>]+> f895 f000 pld \[r5\] |
591 | 591 | 0+6ee <[^>]+> f895 f330 pld \[r5, #816\] |
592 | 592 | 0+6f2 <[^>]+> f815 fc30 pld \[r5, #-48\] |
@@ -596,8 +596,8 @@ Disassembly of section .text: | ||
596 | 596 | 0+702 <[^>]+> f815 fd30 pld \[r5\], #-48 |
597 | 597 | 0+706 <[^>]+> f815 f000 pld \[r5, r0\] |
598 | 598 | 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 <[^>]+> | |
601 | 601 | 0+716 <[^>]+> e9d5 2300 ldrd r2, r3, \[r5\] |
602 | 602 | 0+71a <[^>]+> e9d5 230c ldrd r2, r3, \[r5, #48\] |
603 | 603 | 0+71e <[^>]+> e955 230c ldrd r2, r3, \[r5, #-48\] |
@@ -194,6 +194,7 @@ branches: | ||
194 | 194 | bra bal.n |
195 | 195 | bra b.n |
196 | 196 | @ bl, blx have no short form. |
197 | + .balign 4 | |
197 | 198 | 1: |
198 | 199 | bra beq |
199 | 200 | bra bne |
@@ -218,9 +219,8 @@ branches: | ||
218 | 219 | bra b |
219 | 220 | bra bl |
220 | 221 | bra blx |
222 | + .balign 4 | |
221 | 223 | 1: |
222 | - | |
223 | - bx r0 | |
224 | 224 | bx r9 |
225 | 225 | blx r0 |
226 | 226 | blx r9 |
@@ -2278,61 +2278,75 @@ print_insn_thumb32 (pc, info, given) | ||
2278 | 2278 | unsigned int op = (given & 0x00000f00) >> 8; |
2279 | 2279 | unsigned int i12 = (given & 0x00000fff); |
2280 | 2280 | unsigned int i8 = (given & 0x000000ff); |
2281 | + bfd_boolean writeback = FALSE, postind = FALSE; | |
2282 | + int offset = 0; | |
2281 | 2283 | |
2282 | 2284 | func (stream, "[%s", arm_regnames[Rn]); |
2283 | 2285 | 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 */ | |
2284 | 2290 | { |
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); | |
2287 | 2296 | func (stream, "]"); |
2297 | + break; | |
2288 | 2298 | } |
2289 | - else if (Rn == 15) /* 12-bit negative immediate offset */ | |
2290 | - func (stream, ", #-%u]", i12); | |
2291 | 2299 | else switch (op) |
2292 | 2300 | { |
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 | - | |
2304 | 2301 | case 0xE: /* 8-bit positive immediate offset */ |
2305 | - if (i8) | |
2306 | - func (stream, ", #%u", i8); | |
2307 | - func (stream, "]"); | |
2302 | + offset = i8; | |
2308 | 2303 | break; |
2309 | 2304 | |
2310 | 2305 | case 0xC: /* 8-bit negative immediate offset */ |
2311 | - func (stream, ", #-%u]", i8); | |
2306 | + offset = -i8; | |
2312 | 2307 | break; |
2313 | 2308 | |
2314 | 2309 | case 0xB: /* 8-bit + preindex with wb */ |
2315 | - if (i8) | |
2316 | - func (stream, ", #%u", i8); | |
2317 | - func (stream, "]!"); | |
2310 | + offset = i8; | |
2311 | + writeback = TRUE; | |
2318 | 2312 | break; |
2319 | 2313 | |
2320 | 2314 | case 0x9: /* 8-bit - preindex with wb */ |
2321 | - func (stream, ", #-%u]!", i8); | |
2315 | + offset = -i8; | |
2316 | + writeback = TRUE; | |
2322 | 2317 | break; |
2323 | 2318 | |
2324 | 2319 | case 0xF: /* 8-bit + postindex */ |
2325 | - func (stream, "], #%u", i8); | |
2320 | + offset = i8; | |
2321 | + postind = TRUE; | |
2326 | 2322 | break; |
2327 | 2323 | |
2328 | 2324 | case 0xD: /* 8-bit - postindex */ |
2329 | - func (stream, "], #-%u", i8); | |
2325 | + offset = -i8; | |
2326 | + postind = TRUE; | |
2330 | 2327 | break; |
2331 | 2328 | |
2332 | 2329 | default: |
2333 | 2330 | 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); | |
2334 | 2347 | } |
2335 | 2348 | } |
2349 | + skip: | |
2336 | 2350 | break; |
2337 | 2351 | |
2338 | 2352 | case 'A': |
@@ -2425,7 +2439,7 @@ print_insn_thumb32 (pc, info, given) | ||
2425 | 2439 | unsigned int S = (given & 0x04000000u) >> 26; |
2426 | 2440 | unsigned int J1 = (given & 0x00002000u) >> 13; |
2427 | 2441 | unsigned int J2 = (given & 0x00000800u) >> 11; |
2428 | - unsigned int offset = 0; | |
2442 | + int offset = 0; | |
2429 | 2443 | |
2430 | 2444 | offset |= !S << 20; |
2431 | 2445 | offset |= J2 << 19; |
@@ -2434,7 +2448,7 @@ print_insn_thumb32 (pc, info, given) | ||
2434 | 2448 | offset |= (given & 0x000007ff) << 1; |
2435 | 2449 | offset -= (1 << 20); |
2436 | 2450 | |
2437 | - info->print_address_func ((bfd_vma)offset + pc + 4, info); | |
2451 | + info->print_address_func (pc + 4 + offset, info); | |
2438 | 2452 | } |
2439 | 2453 | break; |
2440 | 2454 |
@@ -2443,7 +2457,7 @@ print_insn_thumb32 (pc, info, given) | ||
2443 | 2457 | unsigned int S = (given & 0x04000000u) >> 26; |
2444 | 2458 | unsigned int I1 = (given & 0x00002000u) >> 13; |
2445 | 2459 | unsigned int I2 = (given & 0x00000800u) >> 11; |
2446 | - unsigned int offset = 0; | |
2460 | + int offset = 0; | |
2447 | 2461 | |
2448 | 2462 | offset |= !S << 24; |
2449 | 2463 | offset |= !(I1 ^ S) << 23; |
@@ -2452,7 +2466,7 @@ print_insn_thumb32 (pc, info, given) | ||
2452 | 2466 | offset |= (given & 0x000007ffu) << 1; |
2453 | 2467 | offset -= (1 << 24); |
2454 | 2468 | |
2455 | - info->print_address_func ((bfd_vma)offset + pc + 4, info); | |
2469 | + info->print_address_func (pc + 4 + offset, info); | |
2456 | 2470 | } |
2457 | 2471 | break; |
2458 | 2472 |