[PATCH v1] ARM: vfp: Use long jump to fix THUMB2 kernel compilation error

Dmitry Osipenko digetx at gmail.com
Thu Oct 22 11:56:58 EDT 2020


22.10.2020 17:57, Russell King - ARM Linux admin пишет:
> On Thu, Oct 22, 2020 at 01:57:37AM +0300, Dmitry Osipenko wrote:
>> The vfp_kmode_exception() function now is unreachable using relative
>> branching in THUMB2 kernel configuration, resulting in a "relocation
>> truncated to fit: R_ARM_THM_JUMP19 against symbol `vfp_kmode_exception'"
>> linker error. Let's use long jump in order to fix the issue.
>>
>> Fixes: eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input sections")
>> Signed-off-by: Dmitry Osipenko <digetx at gmail.com>
> 
> I guess the problem is that vfp_support_entry is in .text which tends
> to be at the beginning of the text section, but vfp_kmode_exception
> is in something like .text.vfp_kmode_exception ?

Indeed, vfp_support_entry is at beginning of .text, while
vfp_kmode_exception is near the end.

> Would it be an idea just to change the section name that stuff like
> vfp_support_entry ends up in, rather than making the code less
> efficient?
> 

This works:

diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index 4fcff9f59947..65f0a2ef3613 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -65,6 +65,7 @@
 #endif
 	.endm

+	.pushsection .vfp11_veneer, "ax"

 @ VFP hardware support entry point.
 @
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 8c9e7f9f0277..30b83b191174 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -642,7 +642,7 @@ static int vfp_starting_cpu(unsigned int unused)
 	return 0;
 }

-void vfp_kmode_exception(void)
+void __section(".vfp11_veneer") vfp_kmode_exception(void)
 {
 	/*
 	 * If we reach this point, a floating point exception has been raised



More information about the linux-arm-kernel mailing list