[PATCH v4 11/16] objtool: Add --mnop as an option to --mcount

Josh Poimboeuf jpoimboe at kernel.org
Wed Oct 12 07:33:32 AEDT 2022


On Mon, Oct 10, 2022 at 05:07:46PM +0530, Naveen N. Rao wrote:
> > +++ b/scripts/Makefile.lib
> > @@ -234,6 +234,7 @@ objtool_args =								\
> >  	$(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr)		\
> >  	$(if $(CONFIG_X86_KERNEL_IBT), --ibt)				\
> >  	$(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)		\
> > +	$(if $(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT), --mnop)                 \
> 
> This still won't help: for instance, if CONFIG_FTRACE itself is disabled. I
> think we should make this depend on CONFIG_FTRACE_MCOUNT_USE_OBJTOOL. The
> below change works for me:
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 54d2d6451bdacc..fd3f55a1fdb7bb 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -245,8 +245,8 @@ 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_HAVE_OBJTOOL_NOP_MCOUNT), --mnop)                 \
> +        $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL),                       \
> +             $(if $(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT), --mcount --mnop, --mcount)) \
>        $(if $(CONFIG_UNWINDER_ORC), --orc)                             \
>        $(if $(CONFIG_RETPOLINE), --retpoline)                          \
>        $(if $(CONFIG_RETHUNK), --rethunk)                              \

This has a new conflict, may need something like:

--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -256,6 +256,9 @@ 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
+ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
+objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT)		+= --mnop
+endif
 objtool-args-$(CONFIG_UNWINDER_ORC)			+= --orc
 objtool-args-$(CONFIG_RETPOLINE)			+= --retpoline
 objtool-args-$(CONFIG_RETHUNK)				+= --rethunk


More information about the Linuxppc-dev mailing list