On Fri, Oct 30, 2026 at 10:37:38AM +0300, Yalçın Can wrote: > With SYS_THUMB_BUILD, config.mk asks for "-mthumb -mthumb-interwork" and > falls back to ARM code (-marm) if the compiler rejects the pair. Clang has > no -mthumb-interwork (interworking is always on), so clang builds come out > as ARM code, about 30 % larger than gcc's Thumb-2 build. > > Try plain -mthumb before falling back to -marm. > > Tested with clang 19 on mk808_defconfig: 467 KB instead of ~600 KB, boots > on an MK808B (RK3066); the interworking veneers around save_boot_params > were checked in the disassembly. > > Co-Authored-By: Claude Opus 5.5 <[email protected]> > Signed-off-by: Yalçın Can <[email protected]> > --- > arch/arm/config.mk | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/config.mk b/arch/arm/config.mk > index bce9a31e..b14c5590 100644 > --- a/arch/arm/config.mk > +++ b/arch/arm/config.mk > @@ -48,9 +48,10 @@ ifeq ($(CONFIG_$(PHASE_)SYS_THUMB_BUILD),y) > AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always) > PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \ > $(call cc-option, -mthumb -mthumb-interwork,\ > + $(call cc-option, -mthumb,\ > $(call cc-option,-marm,)\ > $(call cc-option,-mno-thumb-interwork,)\ > - ) > + )) > else ifneq ($(CONFIG_ARM64),y) > PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \ > $(call cc-option,-mno-thumb-interwork,)
This is a case where I'm glad someone looked at the overall failure. It's maybe why using clang overflows on a bunch of other targets, too. The fix however, is wrong. Looking at where everything came from, we need to look at the linux kernel, and then can see: commit 22905a24306c8c312c2d66da9f90d09af0414f81 Author: Stefan Agner <[email protected]> Date: Tue May 8 22:49:49 2018 +0100 ARM: 8766/1: drop no-thumb-interwork in EABI mode According to GCC documentation -m(no-)thumb-interwork is meaningless in AAPCS configurations. Also clang does not support the flag: clang-5.0: error: unknown argument: '-mno-thumb-interwork' Just drop -mno-thumb-interwork in AEABI configuration. Signed-off-by: Stefan Agner <[email protected]> Signed-off-by: Russell King <[email protected]> And we should just do the same in U-Boot and reference the kernel having made this correction in the above commit. -- Tom
signature.asc
Description: PGP signature
