Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1404857ybv; Fri, 7 Feb 2020 21:10:05 -0800 (PST) X-Google-Smtp-Source: APXvYqz6r6Y5Aszu2FLpShWPVA+asK5mnOpwfsn6RJTikIZsOXua7w5U3tkCQZCMa1FgOGfW4nHs X-Received: by 2002:a54:4195:: with SMTP id 21mr4310271oiy.92.1581138605632; Fri, 07 Feb 2020 21:10:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581138605; cv=none; d=google.com; s=arc-20160816; b=feI3QbSLo89dhQ8KPJyQBtYBl54PodQ0rubO4H3t0/GIyrONmlE7hWthALN4freIUI JRhTdmAooLPDWQOhr+9WeA3RuNnKRrWBfI0s+S3t914Xr8wkBZWiwGXpqQf82vPAopSd vWt/BFIF1DF6Naf/6YXwkDAfZcrAKCWVRO3yaiBSrjhP+wboS9n4VcQ0IvkuRDtQToRY uFn94hgzmYQe60ffmK8/UBvSltSv5uJFJa053CH1IVXUUrt2OewlpEQK9EODBgf+Aswd 31j3fAQ2S9v3GustH3lzPHE4WQrg0QFjP556c0ROprIUPUJeaT4YFXp1kTg/mvbEF6kY oZ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=97ghWMwsTSeLCvlHRl0XU3eSnjbQTX38ag5GiUt60lw=; b=amtHlzbcWTwIg/KOlJtEndlho0F8l5a8ma8S/pw8fUN5lTGNkRfvL/u9mBhz6Upmfc 0dwPNXKC8r/i/mp6GurlNb1LHeiul+pO7zppH30FvvL0tc1BPnfMuzuiyFbgMqnTlv8d 7iQ2QKwvdc4EdH6Gmg3aoxiTQuLkOdmeJ9caD8N4Ky1FE7W+qC3NrX0J84UHnE3xdvCz KHQ1Hkk4N7gUl/KGNox2iQJkulhJ5uFYKIC6lwMFIMx/kHwbdDm9i/T+sSixpPJuYXqU viR56LIintVyMTOg8MLQ5o9nAShMt9WMaXeQoJ7QM41G1ultoK/Ay9PoPh0a9KP6+KQE cniQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CqrAdxv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si5182520oij.84.2020.02.07.21.09.53; Fri, 07 Feb 2020 21:10:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CqrAdxv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbgBHFIz (ORCPT + 99 others); Sat, 8 Feb 2020 00:08:55 -0500 Received: from conssluserg-06.nifty.com ([210.131.2.91]:40195 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgBHFIz (ORCPT ); Sat, 8 Feb 2020 00:08:55 -0500 Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 01858i1i026887; Sat, 8 Feb 2020 14:08:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 01858i1i026887 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1581138526; bh=97ghWMwsTSeLCvlHRl0XU3eSnjbQTX38ag5GiUt60lw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CqrAdxv4BND1qTcUnlhOu9A3xUJLIWoa3D0xwsJceyR6fmh5qu9hbHi5eh+zKpPGh Y5pTO/26oaqFahHCaKzqZMIInZ0ohfWc1vfkjcIstCuopRGS1Y2TwEClvaLFK4dlsA U/LD3xfOAeQt+uyCR8A2YJhMlA/R8Feh90xf8DZ3bu8ggUJJCVcYAoENGHZ8ehoWO8 3+gD8keDO3fAVEpvyz1zj6tjGSfVzNI+XVkal3tyw7Jc489F4UXX8ENRC6PxG2h0qB 5Dp8LKy8XRfJZ0TGc6J8mMVrotOqEJG/WrLU9wH5NTTSoFNrdM99h9HWSavO9Ctfhr E8Mqb026fAVkA== X-Nifty-SrcIP: [209.85.217.51] Received: by mail-vs1-f51.google.com with SMTP id t12so969823vso.13; Fri, 07 Feb 2020 21:08:45 -0800 (PST) X-Gm-Message-State: APjAAAV2J08180nFJ6bQcL4M2lPktuRTEmArjSKDuRYGK+EYB4lzpyjN qc6Edc4EwySotyzKoRxm1htSiofcIP2C2pFURfs= X-Received: by 2002:a05:6102:3102:: with SMTP id e2mr1050508vsh.179.1581138524059; Fri, 07 Feb 2020 21:08:44 -0800 (PST) MIME-Version: 1.0 References: <20200207180755.100561-1-qperret@google.com> <20200207180755.100561-3-qperret@google.com> In-Reply-To: <20200207180755.100561-3-qperret@google.com> From: Masahiro Yamada Date: Sat, 8 Feb 2020 06:08:08 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 2/3] kbuild: split adjust_autoksyms.sh in two parts To: Quentin Perret Cc: Nicolas Pitre , Linux Kernel Mailing List , Linux Kbuild mailing list , Matthias Maennich , "Cc: Android Kernel" , Jessica Yu , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 7, 2020 at 7:08 PM Quentin Perret wrote: > > In order to prepare the ground for a build-time optimization, split > adjust_autoksyms.sh into two scripts: one that generates autoksyms.h > based on all currently available information (whitelist, and .mod > files), and the other to inspect the diff between two versions of > autoksyms.h and trigger appropriate rebuilds. > > Signed-off-by: Quentin Perret > --- > scripts/adjust_autoksyms.sh | 32 ++++----------------------- > scripts/gen_autoksyms.sh | 44 +++++++++++++++++++++++++++++++++++++ > 2 files changed, 48 insertions(+), 28 deletions(-) > create mode 100755 scripts/gen_autoksyms.sh > > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > index 58335eee4b38..ae1e65e9009c 100755 > --- a/scripts/adjust_autoksyms.sh > +++ b/scripts/adjust_autoksyms.sh > @@ -1,14 +1,13 @@ > #!/bin/sh > # SPDX-License-Identifier: GPL-2.0-only > > -# Script to create/update include/generated/autoksyms.h and dependency files > +# Script to update include/generated/autoksyms.h and dependency files > # > # Copyright: (C) 2016 Linaro Limited > # Created by: Nicolas Pitre, January 2016 > # > > -# Create/update the include/generated/autoksyms.h file from the list > -# of all module's needed symbols as recorded on the second line of *.mod files. > +# Update the include/generated/autoksyms.h file. > # > # For each symbol being added or removed, the corresponding dependency > # file's timestamp is updated to force a rebuild of the affected source > @@ -35,31 +34,8 @@ case "$KBUILD_VERBOSE" in > ;; > esac > > -# We need access to CONFIG_ symbols > -. include/config/auto.conf > - > -# The symbol whitelist, relative to the source tree > -eval ksym_wl="${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" > -[[ "$ksym_wl" =~ ^/ ]] || ksym_wl="$abs_srctree/$ksym_wl" > - > -# Generate a new ksym list file with symbols needed by the current > -# set of modules. > -cat > "$new_ksyms_file" << EOT > -/* > - * Automatically generated file; DO NOT EDIT. > - */ > - > -EOT > -sed 's/ko$/mod/' modules.order | > -xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | > -cat - "$ksym_wl" | > -sort -u | > -sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" > - > -# Special case for modversions (see modpost.c) > -if [ -n "$CONFIG_MODVERSIONS" ]; then > - echo "#define __KSYM_module_layout 1" >> "$new_ksyms_file" > -fi > +# Generate a new symbol list file > +$srctree/scripts/gen_autoksyms.sh "$new_ksyms_file" In 3/3, you will call this script with $(CONFIG_SHELL) from Makefile. For consistency, $CONFIG_SHELL $srctree/scripts/gen_autoksyms.sh "$new_ksyms_file" is better. Thanks. > > # Extract changes between old and new list and touch corresponding > # dependency files. > diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh > new file mode 100755 > index 000000000000..ce0919c3791a > --- /dev/null > +++ b/scripts/gen_autoksyms.sh > @@ -0,0 +1,44 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0-only > + > +# Create an autoksyms.h header file from the list of all module's needed symbols > +# as recorded on the second line of *.mod files and the user-provided symbol > +# whitelist. > + > +set -e > + > +output_file="$1" > + > +# Use "make V=1" to debug this script. > +case "$KBUILD_VERBOSE" in > +*1*) > + set -x > + ;; > +esac > + > +# We need access to CONFIG_ symbols > +. include/config/auto.conf > + > +# The symbol whitelist, relative to the source tree > +eval ksym_wl="${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" > +[[ "$ksym_wl" =~ ^/ ]] || ksym_wl="$abs_srctree/$ksym_wl" > + > +# Generate a new ksym list file with symbols needed by the current > +# set of modules. > +cat > "$output_file" << EOT > +/* > + * Automatically generated file; DO NOT EDIT. > + */ > + > +EOT > + > +sed 's/ko$/mod/' modules.order | > +xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | > +cat - "$ksym_wl" | > +sort -u | > +sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file" > + > +# Special case for modversions (see modpost.c) > +if [ -n "$CONFIG_MODVERSIONS" ]; then > + echo "#define __KSYM_module_layout 1" >> "$output_file" > +fi > -- > 2.25.0.341.g760bfbb309-goog > -- Best Regards Masahiro Yamada