aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2025-01-31 23:04:01 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2025-02-01 04:28:05 +0900
commit695ed93bb30e03e9f826ee70abdd83f970741a37 (patch)
tree3ded5ccff06562c0f0414e8215c0185b238a067a /scripts/Makefile.build
parentkbuild: Strip runtime const RELA sections correctly (diff)
downloadlinux-695ed93bb30e03e9f826ee70abdd83f970741a37.tar.gz
linux-695ed93bb30e03e9f826ee70abdd83f970741a37.zip
kbuild: fix Clang LTO with CONFIG_OBJTOOL=n
Since commit bede169618c6 ("kbuild: enable objtool for *.mod.o and additional kernel objects"), Clang LTO builds do not perform any optimizations when CONFIG_OBJTOOL is disabled (e.g., for ARCH=arm64). This is because every LLVM bitcode file is immediately converted to ELF format before the object files are linked together. This commit fixes the breakage. Fixes: bede169618c6 ("kbuild: enable objtool for *.mod.o and additional kernel objects") Reported-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Yonghong Song <yonghong.song@linux.dev>
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 81d9dacad03c..993708d11874 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -194,7 +194,9 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),$(is-kernel-object))
+ifdef CONFIG_OBJTOOL
$(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y))
+endif
ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi)))