Skip to content

Commit a75e524

Browse files
Dave MartinRussell King
authored andcommitted
ARM: 6504/1: Thumb-2: Fix long-distance conditional branches in head.S for Thumb-2.
The 32-bit conditional branches in Thumb-2 have a shorter range (+/-512K) than their ARM counterparts (+/-32MB). The linker does not currently generate trampolines to extend the range of these Thumb-2 conditional branches, resulting in link errors when vmlinux is sufficiently large, e.g.: head.o:(.text+0x464): relocation truncated to fit: R_ARM_THM_JUMP19 This patch forces the longer-range, unconditional branch encoding by use of an explicit IT instruction. The resulting branches are triggered on the same conditions as before. Signed-off-by: Dave Martin <dave.martin@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 26e5ca9 commit a75e524

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/arm/kernel/head.S‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ ENTRY(stext)
8585
mrc p15, 0, r9, c0, c0 @ get processor id
8686
bl __lookup_processor_type @ r5=procinfo r9=cpuid
8787
movs r10, r5 @ invalid processor (r5=0)?
88+
THUMB( it eq ) @ force fixup-able long branch encoding
8889
beq __error_p @ yes, error 'p'
8990
bl __lookup_machine_type @ r5=machinfo
9091
movs r8, r5 @ invalid machine (r5=0)?
92+
THUMB( it eq ) @ force fixup-able long branch encoding
9193
beq __error_a @ yes, error 'a'
9294
bl __vet_atags
9395
#ifdef CONFIG_SMP_ON_UP
@@ -283,6 +285,7 @@ ENTRY(secondary_startup)
283285
bl __lookup_processor_type
284286
movs r10, r5 @ invalid processor?
285287
moveq r0, #'p' @ yes, error 'p'
288+
THUMB( it eq ) @ force fixup-able long branch encoding
286289
beq __error_p
287290

288291
/*

0 commit comments

Comments
 (0)