gas/
* config/tc-arm.c (relax_immediate): Always return positive values.
(relaxed_symbol_addr): New function.
(relax_adr, relax_branch): Use it.
(arm_relax_frag): Pass strect argument. Adjust infinite loop check.
gas/testsuite/
* gas/arm/relax_branch_align.d: New test.
* gas/arm/relax_branch_align.s: New test.
--- /dev/null
+#name: Branch relaxation with alignment.
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+000 <[^>]+> bf00 nop
+0+002 <[^>]+> f000 8080 beq.w 0+106 <[^>]*>
+0+006 <[^>]+> bf00 nop
+#...
+0+100 <[^>]+> bf00 nop
+0+102 <[^>]+> f47f af80 bne.w 0+006 <[^>]*>
+0+106 <[^>]+> bf00 nop
--- /dev/null
+ .syntax unified
+ .thumb
+fn:
+ nop
+.L191:
+ beq .L192
+.L46:
+ nop
+ .align 2
+.L54:
+ .rept 62
+ .word 0
+ .endr
+ nop
+ bne .L46
+.L192:
+ nop