LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH] scripts/recordmcount.pl: Remove check_objcopy() and $can_use_local
Date: Mon, 2 Aug 2021 14:18:33 -0700	[thread overview]
Message-ID: <CAKwvOdmG0Ahieq27y29zqqEfjDu4NiC8j1fDg8c6RPnWVhdSsA@mail.gmail.com> (raw)
In-Reply-To: <20210802210307.3202472-1-nathan@kernel.org>

On Mon, Aug 2, 2021 at 2:05 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When building ARCH=riscv allmodconfig with llvm-objcopy, the objcopy
> version warning from this script appears:
>
> WARNING: could not find objcopy version or version is less than 2.17.
>         Local function references are disabled.
>
> The check_objcopy() function in scripts/recordmcount.pl is set up to
> parse GNU objcopy's version string, not llvm-objcopy's, which triggers
> the warning.
>
> Commit 799c43415442 ("kbuild: thin archives make default for all archs")
> made binutils 2.20 mandatory and commit ba64beb17493 ("kbuild: check the
> minimum assembler version in Kconfig") enforces this at configuration
> time so just remove check_objcopy() and $can_use_local instead, assuming
> --globalize-symbol is always available.
>
> llvm-objcopy has supported --globalize-symbol since LLVM 7.0.0 in 2018
> and the minimum version for building the kernel with LLVM is 10.0.1 so
> there is no issue introduced:
>
> https://github.com/llvm/llvm-project/commit/ee5be798dae30d5f9414b01f76ff807edbc881aa

^ should this be a Link: tag?

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  Makefile                |  1 -
>  scripts/recordmcount.pl | 40 ----------------------------------------
>  2 files changed, 41 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 27a072cffcb9..b6ee64dd435e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -546,7 +546,6 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
>  PHONY += scripts_basic
>  scripts_basic:
>         $(Q)$(MAKE) $(build)=scripts/basic
> -       $(Q)rm -f .tmp_quiet_recordmcount
>
>  PHONY += outputmakefile
>  ifdef building_out_of_srctree
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index c17e48020ec3..8f6b13ae46bf 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -173,39 +173,6 @@ my $mcount_regex;  # Find the call site to mcount (return offset)
>  my $mcount_adjust;     # Address adjustment to mcount offset
>  my $alignment;         # The .align value to use for $mcount_section
>  my $section_type;      # Section header plus possible alignment command
> -my $can_use_local = 0;         # If we can use local function references
> -
> -# Shut up recordmcount if user has older objcopy
> -my $quiet_recordmcount = ".tmp_quiet_recordmcount";
> -my $print_warning = 1;
> -$print_warning = 0 if ( -f $quiet_recordmcount);
> -
> -##
> -# check_objcopy - whether objcopy supports --globalize-symbols
> -#
> -#  --globalize-symbols came out in 2.17, we must test the version
> -#  of objcopy, and if it is less than 2.17, then we can not
> -#  record local functions.
> -sub check_objcopy
> -{
> -    open (IN, "$objcopy --version |") or die "error running $objcopy";
> -    while (<IN>) {
> -       if (/objcopy.*\s(\d+)\.(\d+)/) {
> -           $can_use_local = 1 if ($1 > 2 || ($1 == 2 && $2 >= 17));
> -           last;
> -       }
> -    }
> -    close (IN);
> -
> -    if (!$can_use_local && $print_warning) {
> -       print STDERR "WARNING: could not find objcopy version or version " .
> -           "is less than 2.17.\n" .
> -           "\tLocal function references are disabled.\n";
> -       open (QUIET, ">$quiet_recordmcount");
> -       printf QUIET "Disables the warning from recordmcount.pl\n";
> -       close QUIET;
> -    }
> -}
>
>  if ($arch =~ /(x86(_64)?)|(i386)/) {
>      if ($bits == 64) {
> @@ -434,8 +401,6 @@ if ($filename =~ m,^(.*)(\.\S),) {
>  my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
>  my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o";
>
> -check_objcopy();
> -
>  #
>  # Step 1: find all the local (static functions) and weak symbols.
>  #         't' is local, 'w/W' is weak
> @@ -473,11 +438,6 @@ sub update_funcs
>
>      # is this function static? If so, note this fact.
>      if (defined $locals{$ref_func}) {
> -
> -       # only use locals if objcopy supports globalize-symbols
> -       if (!$can_use_local) {
> -           return;
> -       }
>         $convert{$ref_func} = 1;
>      }
>
>
> base-commit: c500bee1c5b2f1d59b1081ac879d73268ab0ff17
> --
> 2.32.0.264.g75ae10bc75
>


-- 
Thanks,
~Nick Desaulniers

      reply	other threads:[~2021-08-02 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 21:03 Nathan Chancellor
2021-08-02 21:18 ` Nick Desaulniers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdmG0Ahieq27y29zqqEfjDu4NiC8j1fDg8c6RPnWVhdSsA@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH] scripts/recordmcount.pl: Remove check_objcopy() and $can_use_local' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).