All of lore.kernel.org
 help / color / mirror / Atom feed
* + scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch added to -mm tree
@ 2021-08-02 21:30 akpm
  2021-08-04  1:29 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2021-08-02 21:30 UTC (permalink / raw)
  To: mm-commits, rostedt, ndesaulniers, masahiroy, nathan


The patch titled
     Subject: scripts/recordmcount.pl: remove check_objcopy() and $can_use_local
has been added to the -mm tree.  Its filename is
     scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Nathan Chancellor <nathan@kernel.org>
Subject: scripts/recordmcount.pl: remove check_objcopy() and $can_use_local

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:

Link: https://github.com/llvm/llvm-project/commit/ee5be798dae30d5f9414b01f76ff807edbc881aa
Link: https://lkml.kernel.org/r/20210802210307.3202472-1-nathan@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 Makefile                |    1 
 scripts/recordmcount.pl |   40 --------------------------------------
 2 files changed, 41 deletions(-)

--- a/Makefile~scripts-recordmcountpl-remove-check_objcopy-and-can_use_local
+++ a/Makefile
@@ -546,7 +546,6 @@ export RCS_TAR_IGNORE := --exclude SCCS
 PHONY += scripts_basic
 scripts_basic:
 	$(Q)$(MAKE) $(build)=scripts/basic
-	$(Q)rm -f .tmp_quiet_recordmcount
 
 PHONY += outputmakefile
 ifdef building_out_of_srctree
--- a/scripts/recordmcount.pl~scripts-recordmcountpl-remove-check_objcopy-and-can_use_local
+++ a/scripts/recordmcount.pl
@@ -173,39 +173,6 @@ my $mcount_regex;	# Find the call site t
 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;
     }
 
_

Patches currently in -mm which might be from nathan@kernel.org are

scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch added to -mm tree
  2021-08-02 21:30 + scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch added to -mm tree akpm
@ 2021-08-04  1:29 ` Steven Rostedt
  2021-08-04  4:36   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2021-08-04  1:29 UTC (permalink / raw)
  To: akpm; +Cc: mm-commits, ndesaulniers, masahiroy, nathan

On Mon, 02 Aug 2021 14:30:40 -0700
akpm@linux-foundation.org wrote:

> The patch titled
>      Subject: scripts/recordmcount.pl: remove check_objcopy() and $can_use_local
> has been added to the -mm tree.  Its filename is
>      scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch

Thanks Andrew,

But I'll pulling it through my tree.

I'll even send it up with my urgent push into the -rc release.

-- Steve

> 
> This patch should soon appear at
>     https://ozlabs.org/~akpm/mmots/broken-out/scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch
> and later at
>     https://ozlabs.org/~akpm/mmotm/broken-out/scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
> 
> ------------------------------------------------------
> From: Nathan Chancellor <nathan@kernel.org>
> Subject: scripts/recordmcount.pl: remove check_objcopy() and $can_use_local
> 
> 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:
> 
> Link: https://github.com/llvm/llvm-project/commit/ee5be798dae30d5f9414b01f76ff807edbc881aa
> Link: https://lkml.kernel.org/r/20210802210307.3202472-1-nathan@kernel.org
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  Makefile                |    1 
>  scripts/recordmcount.pl |   40 --------------------------------------
>  2 files changed, 41 deletions(-)
> 
> --- a/Makefile~scripts-recordmcountpl-remove-check_objcopy-and-can_use_local
> +++ a/Makefile
> @@ -546,7 +546,6 @@ export RCS_TAR_IGNORE := --exclude SCCS
>  PHONY += scripts_basic
>  scripts_basic:
>  	$(Q)$(MAKE) $(build)=scripts/basic
> -	$(Q)rm -f .tmp_quiet_recordmcount
>  
>  PHONY += outputmakefile
>  ifdef building_out_of_srctree
> --- a/scripts/recordmcount.pl~scripts-recordmcountpl-remove-check_objcopy-and-can_use_local
> +++ a/scripts/recordmcount.pl
> @@ -173,39 +173,6 @@ my $mcount_regex;	# Find the call site t
>  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;
>      }
>  
> _
> 
> Patches currently in -mm which might be from nathan@kernel.org are
> 
> scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch added to -mm tree
  2021-08-04  1:29 ` Steven Rostedt
@ 2021-08-04  4:36   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2021-08-04  4:36 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mm-commits, ndesaulniers, masahiroy, nathan

On Tue, 3 Aug 2021 21:29:11 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 02 Aug 2021 14:30:40 -0700
> akpm@linux-foundation.org wrote:
> 
> > The patch titled
> >      Subject: scripts/recordmcount.pl: remove check_objcopy() and $can_use_local
> > has been added to the -mm tree.  Its filename is
> >      scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch
> 
> Thanks Andrew,
> 
> But I'll pulling it through my tree.
> 
> I'll even send it up with my urgent push into the -rc release.

If/when it turns up in linux-next, I drop my copy (after checking it
was the same),

So it's all basically automatic - no need to tell me!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 21:30 + scripts-recordmcountpl-remove-check_objcopy-and-can_use_local.patch added to -mm tree akpm
2021-08-04  1:29 ` Steven Rostedt
2021-08-04  4:36   ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.