mirror of
https://github.com/Fishwaldo/build.git
synced 2025-04-14 01:51:39 +00:00
43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
vfp: force non-conditional encoding for external Thumb2
|
|
|
|
Nick reports that the following error is produced in some cases when
|
|
using GCC+ld.bfd to build the ARM defconfig with Thumb2 enabled:
|
|
|
|
arch/arm/vfp/vfphw.o: in function `vfp_support_entry':
|
|
(.text+0xa): relocation truncated to fit: R_ARM_THM_JUMP19 against
|
|
symbol `vfp_kmode_exception' defined in .text.unlikely section in
|
|
arch/arm/vfp/vfpmodule.o
|
|
|
|
$ arm-linux-gnueabihf-ld --version
|
|
GNU ld (GNU Binutils for Debian) 2.34
|
|
|
|
Generally, the linker should be able to fix up out of range branches by
|
|
emitting veneers, but apparently, it fails to do so in this particular
|
|
case, i.e., a conditional 'tail call' to vfp_kmode_exception(), which
|
|
is not defined in the same object file.
|
|
|
|
So let's force the use of a non-conditional encoding of the B instruction,
|
|
which has more space for an immediate offset. To compensate for the
|
|
additional 2 byte IT opcode, switch the preceding TEQ to CMP, which can
|
|
be emitted in 2 bytes instead of 4 bytes as well.
|
|
|
|
Fixes: eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input sections")
|
|
Reported-by: Nick Desaulniers <(address hidden)>
|
|
Tested-by: Nick Desaulniers <(address hidden)>
|
|
Signed-off-by: Ard Biesheuvel <(address hidden)>
|
|
---
|
|
|
|
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
|
|
index 4fcff9f59947..06ff091c0932 100644
|
|
--- a/arch/arm/vfp/vfphw.S
|
|
+++ b/arch/arm/vfp/vfphw.S
|
|
@@ -81,7 +81,8 @@ ENTRY(vfp_support_entry)
|
|
.fpu vfpv2
|
|
ldr r3, [sp, #S_PSR] @ Neither lazy restore nor FP exceptions
|
|
and r3, r3, #MODE_MASK @ are supported in kernel mode
|
|
- teq r3, #USR_MODE
|
|
+ cmp r3, #USR_MODE
|
|
+THUMB( it ne )
|
|
bne vfp_kmode_exception @ Returns through lr
|
|
|
|
VFPFMRX r1, FPEXC @ Is the VFP enabled?
|