Re: [GIT pull] objtool/urgent for v5.19-rc1

From: Linus Torvalds
Date: Sun Jun 05 2022 - 13:14:36 EST


On Sun, Jun 5, 2022 at 2:30 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 06400504150b..6a663b27b286 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -218,7 +218,7 @@ objtool_args = \
> $(if $(CONFIG_SLS), --sls) \
> $(if $(CONFIG_STACK_VALIDATION), --stackval) \
> $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \
> - --uaccess \
> + $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess) \
> $(if $(linked-object), --link) \
> $(if $(part-of-module), --module) \
> $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)

Since this clashed with the Kbuild cleanups I just merged, I looked at
it and threw up in my mouth a little.

Not a new problem, but can we do something like that attached, perhaps?

Untested, but looks trivially obvious. FamousLastWords(tm).

Linus
scripts/Makefile.lib | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index d1425778664b..c79ced81130d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -229,20 +229,21 @@ ifdef CONFIG_OBJTOOL

objtool := $(objtree)/tools/objtool/objtool

-objtool_args = \
- $(if $(CONFIG_HAVE_JUMP_LABEL_HACK), --hacks=jump_label) \
- $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr) \
- $(if $(CONFIG_X86_KERNEL_IBT), --ibt) \
- $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \
- $(if $(CONFIG_UNWINDER_ORC), --orc) \
- $(if $(CONFIG_RETPOLINE), --retpoline) \
- $(if $(CONFIG_SLS), --sls) \
- $(if $(CONFIG_STACK_VALIDATION), --stackval) \
- $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \
- $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess) \
- $(if $(delay-objtool), --link) \
- $(if $(part-of-module), --module) \
- $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
+objtool_args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
+objtool_args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
+objtool_args-$(CONFIG_X86_KERNEL_IBT) += --ibt
+objtool_args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
+objtool_args-$(CONFIG_UNWINDER_ORC) += --orc
+objtool_args-$(CONFIG_RETPOLINE) += --retpoline
+objtool_args-$(CONFIG_SLS) += --sls
+objtool_args-$(CONFIG_STACK_VALIDATION) += --stackval
+objtool_args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
+objtool_args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
+objtool_args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
+
+objtool_args = $(objtool_args-y) \
+ $(if $(delay-objtool), --link) \
+ $(if $(part-of-module), --module)

delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT))