Thread (31 messages) 31 messages, 5 authors, 2020-09-18

Re: [PATCH 00/12] ARM: use adr_l/ldr_l macros for PC-relative references

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2020-09-16 20:46:44
Also in: linux-efi
Subsystem: arm port, arm/vfp support, the rest · Maintainers: Russell King, Linus Torvalds

On Wed, 16 Sep 2020 at 22:53, Nick Desaulniers [off-list ref] wrote:
On Tue, Sep 15, 2020 at 10:55 PM Ard Biesheuvel [off-list ref] wrote:
quoted
On Wed, 16 Sep 2020 at 02:31, Nick Desaulniers [off-list ref] wrote:
quoted
On Tue, Sep 15, 2020 at 2:30 PM Ard Biesheuvel [off-list ref] wrote:
quoted
Excellent, thanks for testing. Do you have any coverage for Thumb2
builds as well? (CONFIG_THUMB2_KERNEL=y)
Ah, right, manually testing ARCH=arm defconfig with
CONFIG_THUMB2_KERNEL enabled via menuconfig:

Builds and boots for clang.

(Also needed https://lore.kernel.org/lkml/20200915225751.274531-1-ndesaulniers@google.com/T/#u (local)
for an unrelated issue).

For GCC, I observe:

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
Interesting. And this is using ld.bfd ?
$ arm-linux-gnueabihf-ld --version
GNU ld (GNU Binutils for Debian) 2.34

.text.unlikely reminds me of the sections created when profiling data
is present.  That's obviously not the case here, so maybe there's
other ways this section can be created by GCC?  I may have added a
patch recently for placing this section explicitly, which was a
prerequisite for Kees' series explicitly placing all sections.
https://lore.kernel.org/lkml/159896087937.20229.4955362311782724603.tip-bot2@tip-bot2/ (local)
Maybe that can be improved?

IIRC, LLD is able to emit range extension thunks for these cases, but
BFD does not.
ld.bfd will usually emit veneers for branches that turn out to be out
of range in the final link stage.

Does the following help?
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?
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help