Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1935743pxy; Mon, 2 Aug 2021 14:22:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOmb/v0Yms7N38QRoLsbXyXv5sCIs3BOLDXB08BPHVsz9GfSfbZqg6n8Nt3WyZk2U1l5jJ X-Received: by 2002:a17:906:6490:: with SMTP id e16mr17004040ejm.467.1627939350637; Mon, 02 Aug 2021 14:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627939350; cv=none; d=google.com; s=arc-20160816; b=GQnAIJZC6jfFBQoMdeuI+yf0aptP97EQQgjZIwFH/ZUPL0nksc9ZV81spcOmNE7Pqh zS4selbWT5azDTDGWI5LJTzjG5Ycljd18OprWlZgjnEnkCV7zL645PliMjuEFQt5A+kC W089FVboRjcTtz9o/+BfBqNwlAD/X2uSNAEDbHNgwjeoxmB8MllSqNMZ12vA2JZ78jI3 0wyOXYq3D2/eSm5i7XRzy2yDDkoRZunNBV4ToCU3OFlnIq3OTmErHYFSvX9ZN9ytP+RR P6Hhi4BXUnVKuMqbfWky/75t2pFhNcKlQr/7Ja4sqmLgNJgyIwh8qAsr+hqME5Hp3lpN X3sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1Z9yRMRPvPvhNhspEK5nK4+ikbIcB7z17ForMSSXLIM=; b=BBuT4FMb9OOEbdRho+orgz/CK9ekGzTRjLiJgg2OIP1TZp704rGV+rUs/VzIKr/GtV CufNltngcFY86aCr1b4mcVOOu7miXq81JtSV6v25EsMnMrXEZTK52vvQ8THZ5Mt95Rxe /rJJHZRPmZsz/j96rFl37yUfBvB+RohZN8+ldqvBXborSVyhFS7qdtIDJl0EOx54Kjzu SlUGURdwfbKEgKou+QtGzE0fI7gghSzNyWfU1EzLRxfnOPTohDGE5HoDPYocBzN8IcVG asuCtJcfPhwMckRlIw8hDrUaD3TulcJDnuVdKLM15SwQ/mOWLbSwI4sSnZM1oqOzpMGX A+UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kXYzxNBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f15si11177948eds.511.2021.08.02.14.22.07; Mon, 02 Aug 2021 14:22:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kXYzxNBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231656AbhHBVS5 (ORCPT + 99 others); Mon, 2 Aug 2021 17:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbhHBVS4 (ORCPT ); Mon, 2 Aug 2021 17:18:56 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF66C06175F for ; Mon, 2 Aug 2021 14:18:46 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id n6so25606755ljp.9 for ; Mon, 02 Aug 2021 14:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Z9yRMRPvPvhNhspEK5nK4+ikbIcB7z17ForMSSXLIM=; b=kXYzxNBoPnSs60tSumVikXkgLSMYmd8MP0QG9/neTn5fMj+4x9WawziIkd++CZ5Qlt LECxLgnwPznfHsA5PWYTAUZcwobBzWh80Tt4aQXaaleOkLjYK0Mq8RzPk9nZGdeDgm7R lkW3sfjIbPL7zqRIDSArn2AXnywcz5L+8EHVNZ3jIkshvWrqL3H+IKcB9RiEbL5S1rgk 5cMPRVE4Hi0IN3Sgbpol4+Risi2OaHtQSi4Iv/bPa8vkqp9Jm21EP5vhwyGCaQIHI9UQ eR4HDqRpIYqeWX7Py7Bjt5DgbZkzxHEN9++aKaW38yML2aT/Cmg3hJDrK+U5vy1nsObC c+BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Z9yRMRPvPvhNhspEK5nK4+ikbIcB7z17ForMSSXLIM=; b=qvGCvv4GQj7glIBLSdA4Sx7N6X+8oAn2gqu4TYrPh5s7+DWlo36QIy/RVUie25VWWj S9b5Msjba/Ax8y0hdJPF5q1gGekrHKN9XzzEoE5Hc6ILrerL0WSRuvxYm78TD+GkcceV W9/47HLViWyjY1Bkf/XEGzzuosAVxiFtqHsMhbOlapQAk4j/g37cF5UBpK76c4puXfwR bpplG3oHO0FHXqVaimdzFruthLvGtWmjTQIjTWbiz9+juMDvN+9osRMBpJ/xFVnKEPil 7sNabGJ4wE2vsPWmG2IhhSIpWLj34b/BEy1jYOSUNHt1GRxWuPGDlO7JmA3lxMdbsboG wObg== X-Gm-Message-State: AOAM531R7keTR6TjrjnZnsf7JR7e9CjfEUbvj27+6EnqXwtG8ztzZxqn MHI/2kZGfbcxmHqjQj/KCDKX2sb8jec8tm5jVFcR0A== X-Received: by 2002:a2e:9304:: with SMTP id e4mr12467173ljh.244.1627939124801; Mon, 02 Aug 2021 14:18:44 -0700 (PDT) MIME-Version: 1.0 References: <20210802210307.3202472-1-nathan@kernel.org> In-Reply-To: <20210802210307.3202472-1-nathan@kernel.org> From: Nick Desaulniers Date: Mon, 2 Aug 2021 14:18:33 -0700 Message-ID: Subject: Re: [PATCH] scripts/recordmcount.pl: Remove check_objcopy() and $can_use_local To: Nathan Chancellor Cc: "Steven Rostedt (VMware)" , Andrew Morton , Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 2, 2021 at 2:05 PM Nathan Chancellor 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 > > Signed-off-by: Nathan Chancellor > --- > 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 () { > - 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