diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index a9839cd..b09bf81 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -9845,7 +9845,9 @@ do_t_branch (void) if (unified_syntax && (inst.size_req == 4 - || (inst.size_req != 2 && inst.operands[0].hasreloc))) + || (inst.size_req != 2 + && (inst.operands[0].hasreloc + || inst.reloc.exp.X_op == O_constant)))) { inst.instruction = THUMB_OP32(opcode); if (cond == COND_ALWAYS) diff --git a/gas/testsuite/gas/arm/t2-branch-global.d b/gas/testsuite/gas/arm/t2-branch-global.d new file mode 100644 index 0000000..5850d6b --- /dev/null +++ b/gas/testsuite/gas/arm/t2-branch-global.d @@ -0,0 +1,14 @@ +#name: Thumb-2 branch to constant address +#This test is only valid on ELF based ports. +#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* +#objdump: -rd + + +.*: +file format.*arm.* + + +Disassembly of section .text: + +00000000 : + 0: f... b... b\.w .* + 0: R_ARM_THM_JUMP24 \*ABS\*.* diff --git a/gas/testsuite/gas/arm/t2-branch-global.s b/gas/testsuite/gas/arm/t2-branch-global.s new file mode 100644 index 0000000..223d924 --- /dev/null +++ b/gas/testsuite/gas/arm/t2-branch-global.s @@ -0,0 +1,5 @@ +.thumb +.arch armv7 +.syntax unified +foo: + b 0x10 @ Assembler must not relax this