Re: [PATCH v11 3/3] kbuild: distributed build support for Clang ThinLTO

From: Nathan Chancellor

Date: Thu May 28 2026 - 18:11:49 EST


On Thu, 28 May 2026 13:39:05 -0700, xur@xxxxxxxxxx <xur@xxxxxxxxxx> wrote:
> diff --git a/scripts/Makefile.thinlto b/scripts/Makefile.thinlto
> new file mode 100644
> index 000000000000..408b63786a08
> --- /dev/null
> +++ b/scripts/Makefile.thinlto
> @@ -0,0 +1,41 @@
> +PHONY := __default
> +__default:
> +
> +include include/config/auto.conf
> +include $(srctree)/scripts/Kbuild.include
> +include $(srctree)/scripts/Makefile.lib
> +
> +native-objs := $(patsubst %.o,%.thinlto-native.o,$(call read-file, vmlinux.thinlto-index))
> +
> +__default: $(native-objs)
> +
> +# Generate .thinlto-native.o (obj) from .o (bitcode) and .thinlto.bc (summary) files
> +# ---------------------------------------------------------------------------
> +quiet_cmd_cc_o_bc = CC $(quiet_modtag) $@
> + be_flags = $(saved_c_flags_$(<))

This change...

> [ ... skip 20 lines ... ]
> +prereq-ir-objs := $(targets:%.thinlto-native.o=%.o)
> +existing-ir-objs := $(wildcard $(sort $(prereq-ir-objs)))
> +
> +-include $(foreach f, $(existing-targets) $(existing-ir-objs), $(dir $(f)).$(notdir $(f)).cmd)
> +
> +.PHONY: $(PHONY)

... and this change appear to break the build in certain circumstances.

| $ printf 'CONFIG_%s\n' LTO_NONE=n LTO_CLANG_THIN_DIST=y >kernel/configs/repro.config
|
| $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper defconfig repro.config vmlinux
| ...
| warning: linking module 'virt/kvm/coalesced_mmio.o': Linking two modules of different target triples: 'mm/slab_common.o' is 'aarch64-unknown-linux-gnu' whereas 'virt/kvm/coalesced_mmio.o' is 'x86_64-unknown-linux-gnu' [-Wlinker-warnings]
| '+v8a' is not a recognized feature for this target (ignoring feature)
| '-fmv' is not a recognized feature for this target (ignoring feature)
| '-fp-armv8' is not a recognized feature for this target (ignoring feature)
| '-neon' is not a recognized feature for this target (ignoring feature)
| '+v8a' is not a recognized feature for this target (ignoring feature)
| '-fmv' is not a recognized feature for this target (ignoring feature)
| '-fp-armv8' is not a recognized feature for this target (ignoring feature)
| '-neon' is not a recognized feature for this target (ignoring feature)
| <inline asm>:1:2: error: invalid instruction mnemonic 'dmb'
| dmb ishst
| ^~~
| 2 warnings and 3 errors generated.
| make[5]: *** [scripts/Makefile.thinlto:22: virt/kvm/dirty_ring.thinlto-native.o] Error 1
| ...

Looking at V=1 output, the backend flags are missing from this object
and the other ones that errored. If I revert back to how you had it in
v10, the build is successful and the flags appear to be included
properly.

Sashiko has another comment as well.

https://sashiko.dev/#/patchset/26003?part=3

--
Cheers,
Nathan