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

From: "Naveen N. Rao" <[email-masked]>
Date: Thu, 15 Sep 2022 12:26:06 +0530

kernel test robot wrote:
> Hi Sathvika,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on powerpc/topic/ppc-kvm]
> [also build test ERROR on linus/master v6.0-rc5]
> [cannot apply to powerpc/next masahiroy-kbuild/for-next next-20220912]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Sathvika-Vasireddy/objtool-Enable-and-implement-mcount-option-on-powerpc/20220912-163023
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git topic/ppc-kvm
> config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20220913/[email-masked]/config)
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> reproduce (this is a W=1 build):
>         # https://github.com/intel-lab-lkp/linux/commit/ca5e2b42c0d4438ba93623579b6860b98f3598f3
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Sathvika-Vasireddy/objtool-Enable-and-implement-mcount-option-on-powerpc/20220912-163023
>         git checkout ca5e2b42c0d4438ba93623579b6860b98f3598f3
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <[email-masked]>

Thanks.

> 
> All errors (new ones prefixed by >>):
> 
>>> cc1: error: '-mnop-mcount' is not implemented for '-fPIC'

CONFIG_NOP_MCOUNT is used for FTRACE_MCOUNT_USE_CC, so instead of:

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f9920f1341c8..a8dd138df637 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -189,6 +189,7 @@ config X86
        select HAVE_CONTEXT_TRACKING_USER_OFFSTACK      if HAVE_CONTEXT_TRACKING_USER
        select HAVE_C_RECORDMCOUNT
        select HAVE_OBJTOOL_MCOUNT              if HAVE_OBJTOOL
+       select HAVE_NOP_MCOUNT                  if HAVE_OBJTOOL_MCOUNT
        select HAVE_BUILDTIME_MCOUNT_SORT
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_CONTIGUOUS

I think you should do:

+       select HAVE_NOP_MCOUNT                  if FTRACE_MCOUNT_USE_OBJTOOL

I was hoping we could reuse CONFIG_NOP_MCOUNT seeing as it is only used 
by s390, but I now wonder if it is better to just keep that separate. We 
could introduce HAVE_OBJTOOL_NOP_MCOUNT for objtool instead.

- Naveen