Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a75e5248 authored by Dave Martin's avatar Dave Martin Committed by Russell King
Browse files

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: default avatarDave Martin <dave.martin@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 26e5ca93
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -85,9 +85,11 @@ ENTRY(stext)
	mrc	p15, 0, r9, c0, c0		@ get processor id
	mrc	p15, 0, r9, c0, c0		@ get processor id
	bl	__lookup_processor_type		@ r5=procinfo r9=cpuid
	bl	__lookup_processor_type		@ r5=procinfo r9=cpuid
	movs	r10, r5				@ invalid processor (r5=0)?
	movs	r10, r5				@ invalid processor (r5=0)?
 THUMB( it	eq )		@ force fixup-able long branch encoding
	beq	__error_p			@ yes, error 'p'
	beq	__error_p			@ yes, error 'p'
	bl	__lookup_machine_type		@ r5=machinfo
	bl	__lookup_machine_type		@ r5=machinfo
	movs	r8, r5				@ invalid machine (r5=0)?
	movs	r8, r5				@ invalid machine (r5=0)?
 THUMB( it	eq )		@ force fixup-able long branch encoding
	beq	__error_a			@ yes, error 'a'
	beq	__error_a			@ yes, error 'a'
	bl	__vet_atags
	bl	__vet_atags
#ifdef CONFIG_SMP_ON_UP
#ifdef CONFIG_SMP_ON_UP
@@ -283,6 +285,7 @@ ENTRY(secondary_startup)
	bl	__lookup_processor_type
	bl	__lookup_processor_type
	movs	r10, r5				@ invalid processor?
	movs	r10, r5				@ invalid processor?
	moveq	r0, #'p'			@ yes, error 'p'
	moveq	r0, #'p'			@ yes, error 'p'
 THUMB( it	eq )		@ force fixup-able long branch encoding
	beq	__error_p
	beq	__error_p


	/*
	/*