Skip to content

Commit 4759670

Browse files
jpoimboeingomolnar
authored andcommitted
objtool: Fix CONFIG_OBJTOOL_WERROR for vmlinux.o
With (!X86_KERNEL_IBT && !LTO_CLANG && NOINSTR_VALIDATION), objtool runs on both translation units and vmlinux.o. With CONFIG_OBJTOOL_WERROR, the TUs get --Werror but vmlinux.o doesn't. Fix that. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/4f71ab9b947ffc47b6a87dd3b9aff4bb32b36d0a.1742852846.git.jpoimboe@kernel.org
1 parent 1154bbd commit 4759670

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/Makefile.vmlinux_o

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@ endif
3030
# objtool for vmlinux.o
3131
# ---------------------------------------------------------------------------
3232
#
33-
# For LTO and IBT, objtool doesn't run on individual translation units.
34-
# Run everything on vmlinux instead.
33+
# For delay-objtool (IBT or LTO), objtool doesn't run on individual translation
34+
# units. Instead it runs on vmlinux.o.
35+
#
36+
# For !delay-objtool + CONFIG_NOINSTR_VALIDATION, it runs on both translation
37+
# units and vmlinux.o, with the latter only used for noinstr/unret validation.
3538

3639
objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
3740

38-
vmlinux-objtool-args-$(delay-objtool) += $(objtool-args-y)
41+
ifeq ($(delay-objtool),y)
42+
vmlinux-objtool-args-y += $(objtool-args-y)
43+
else
44+
vmlinux-objtool-args-$(CONFIG_OBJTOOL_WERROR) += --Werror
45+
endif
46+
3947
vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
4048
vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \
4149
$(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SRSO)), --unret)

0 commit comments

Comments
 (0)