Skip to content

Commit b18b851

Browse files
nathanchancerostedt
authored andcommitted
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 799c434 ("kbuild: thin archives make default for all archs") made binutils 2.20 mandatory and commit ba64beb ("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: llvm/llvm-project@ee5be79 Link: https://lkml.kernel.org/r/20210802210307.3202472-1-nathan@kernel.org Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent a9d10ca commit b18b851

2 files changed

Lines changed: 0 additions & 41 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
546546
PHONY += scripts_basic
547547
scripts_basic:
548548
$(Q)$(MAKE) $(build)=scripts/basic
549-
$(Q)rm -f .tmp_quiet_recordmcount
550549

551550
PHONY += outputmakefile
552551
ifdef building_out_of_srctree

scripts/recordmcount.pl

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -173,39 +173,6 @@
173173
my $mcount_adjust; # Address adjustment to mcount offset
174174
my $alignment; # The .align value to use for $mcount_section
175175
my $section_type; # Section header plus possible alignment command
176-
my $can_use_local = 0; # If we can use local function references
177-
178-
# Shut up recordmcount if user has older objcopy
179-
my $quiet_recordmcount = ".tmp_quiet_recordmcount";
180-
my $print_warning = 1;
181-
$print_warning = 0 if ( -f $quiet_recordmcount);
182-
183-
##
184-
# check_objcopy - whether objcopy supports --globalize-symbols
185-
#
186-
# --globalize-symbols came out in 2.17, we must test the version
187-
# of objcopy, and if it is less than 2.17, then we can not
188-
# record local functions.
189-
sub check_objcopy
190-
{
191-
open (IN, "$objcopy --version |") or die "error running $objcopy";
192-
while (<IN>) {
193-
if (/objcopy.*\s(\d+)\.(\d+)/) {
194-
$can_use_local = 1 if ($1 > 2 || ($1 == 2 && $2 >= 17));
195-
last;
196-
}
197-
}
198-
close (IN);
199-
200-
if (!$can_use_local && $print_warning) {
201-
print STDERR "WARNING: could not find objcopy version or version " .
202-
"is less than 2.17.\n" .
203-
"\tLocal function references are disabled.\n";
204-
open (QUIET, ">$quiet_recordmcount");
205-
printf QUIET "Disables the warning from recordmcount.pl\n";
206-
close QUIET;
207-
}
208-
}
209176

210177
if ($arch =~ /(x86(_64)?)|(i386)/) {
211178
if ($bits == 64) {
@@ -434,8 +401,6 @@ sub check_objcopy
434401
my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
435402
my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o";
436403

437-
check_objcopy();
438-
439404
#
440405
# Step 1: find all the local (static functions) and weak symbols.
441406
# 't' is local, 'w/W' is weak
@@ -473,11 +438,6 @@ sub update_funcs
473438

474439
# is this function static? If so, note this fact.
475440
if (defined $locals{$ref_func}) {
476-
477-
# only use locals if objcopy supports globalize-symbols
478-
if (!$can_use_local) {
479-
return;
480-
}
481441
$convert{$ref_func} = 1;
482442
}
483443

0 commit comments

Comments
 (0)