[PATCH] ARM: vfp: force non-conditional encoding for external Thumb2 tail call
Ard Biesheuvel
ardb at kernel.org
Thu Sep 17 02:19:48 EDT 2020
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.
Cc: <stable at vger.kernel.org>
Reported-by: Nick Desaulniers <ndesaulniers at google.com>
Tested-by: Nick Desaulniers <ndesaulniers at google.com>
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
arch/arm/vfp/vfphw.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index 4fcff9f59947..f1468702fbc9 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -82,6 +82,7 @@ ENTRY(vfp_support_entry)
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
+THUMB( it ne )
bne vfp_kmode_exception @ Returns through lr
VFPFMRX r1, FPEXC @ Is the VFP enabled?
--
2.17.1
More information about the linux-arm-kernel
mailing list