Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp850887ybl; Wed, 29 Jan 2020 10:44:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz4ujMUgm/dIWHdSmxBeauxQjYyEFaRDJuzAQu43Pr4/x1vv7GlXtp9r/bY6ufm2ZsgK71I X-Received: by 2002:a9d:111:: with SMTP id 17mr481367otu.335.1580323462217; Wed, 29 Jan 2020 10:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580323462; cv=none; d=google.com; s=arc-20160816; b=HvjQ1zDEYZ3yiqunDNj1vg5MxT8cvaM4ent4M7ZF7mdwEsEenvegazLEk396YzvH2z SNPpjXesDSPYSatwPwiuAnOpQ/kXbjSWwo4GNPF9sicAx/CMtogz3raV0GeN5KgW1J2o x+y8RRQZeiUvd/xMCsHKDvtBcibCtbZDICPy2UYE2U2ipvPdGVg39MCd3sGYxNFZTRS9 nbEi7ebo8O4uvKOB8x5ezLxilhXeqR0TaEr1t2tVmmuX5pv9eQUUISPjtcwwBC/xTQqC 9X7k6rFSn9ijrCnTZLiP2P4wmhjfWmAP9opZyvsqhh5yMOG0wqdh1OFsjzA5yIPZ/hRE 3gdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/s6cDvkb8rH6WuQlcXvY/UY9gJge/e/144cD+EfClqw=; b=BC6ByjWIzMnCeu/2t2U521O21bQ2OgiH72+UQD1thE/DTQ7GIgd38YoARr/GRJ6wXE UuzWYZLBWDGieC2T0OxRRAWDCsN3CwvR9FAcSp2C297nn0kWPvC16DV4dU2ivQeppG/A 4JWv/6n5ToNkAl0WVw8+0XxicZTasHaoDZYVDVj5aSbh1B1RfjHV0t9eP9lkcrfmYz74 vzPD2S3Zot6N3ScO7Odi7DmotWxAenRlyPtpt8gjWhh8O+Qy9w3u93b2N7AoYxEGXE4b gZkCHEXjhS7VlA93D9gHhRCqFy4gIAPxadribXpHpSRDNjhkrHJDxKjvfre83j+lONwa q9MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LSffM5aQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si1397586oie.151.2020.01.29.10.44.10; Wed, 29 Jan 2020 10:44:22 -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=@google.com header.s=20161025 header.b=LSffM5aQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727337AbgA2RhV (ORCPT + 99 others); Wed, 29 Jan 2020 12:37:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46044 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbgA2RhV (ORCPT ); Wed, 29 Jan 2020 12:37:21 -0500 Received: by mail-wr1-f65.google.com with SMTP id a6so322311wrx.12 for ; Wed, 29 Jan 2020 09:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/s6cDvkb8rH6WuQlcXvY/UY9gJge/e/144cD+EfClqw=; b=LSffM5aQau2KIj1xQ4qQ7sp51CVktf6GWqpWAoL+5rV+P9ceSt/qBIY7vXoufQ4bwv M0Up9Zjaitx3ZBEDwMD7UEDbQ38x5IBg9Cw1GoPh5B+BeFdasmM9jFY3PP2xABmI4Wrv 0qr6X91tVDNoiVal51slXbM/Xn/idvuRdGo5jZKXcj/vgXqSDd0vGoiVmdsvYU/XYJOq q7bi92Gl7inrH7aYJR31pt0zKkMYSzmEoHos6pe/F5rNVgtqIRVJgFSU6MXLWtMoGLPO c4F70tfWZ0e968zWZsz0E2sjmON5vSmWFm7wAkSoRfKhr1IriyhSMw1SUqBW071lHN7J dH3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/s6cDvkb8rH6WuQlcXvY/UY9gJge/e/144cD+EfClqw=; b=h87+tDTl3g6UNB/Q5fwT4SLpAud8DZgjOm0Qpn8/SV924qX+avwI6jcls0CqEfMOLz VVPgxtKTuv9TwgbAFd2hCk/ejybOjG705Ouv8El/mEoQT92N4LdGdMHEPb5kx1+9ZuZn q/tZCywWWiICBgXe+PEXc9MtFeRIkFaIuo9L5+E5l6StQPexNXg95PtShr2SgCvLIy4X LMbGfamp5rf/9HqiisYAuEZWJXvZAV2UU3ZJZ6txvs9BT54mbuTJjr7Jrq/Lvc3t+zTA 0wf66S0btygIL8i6ITuEmXN4QdQJT1EiOroJnJW2yOktbXm0w4JmganM89ofaVOwBRWt ga1g== X-Gm-Message-State: APjAAAXORXZosd0a0F2jwwYkZR8dZbPjcrnRzWFUbNL9Lf4s2Dd8s59O +0y9vgoGbU52Ek+6Jn01xJA0KQ== X-Received: by 2002:a5d:558d:: with SMTP id i13mr36221601wrv.364.1580319438648; Wed, 29 Jan 2020 09:37:18 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id y7sm1516791wrr.56.2020.01.29.09.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 09:37:18 -0800 (PST) Date: Wed, 29 Jan 2020 17:37:14 +0000 From: Quentin Perret To: Nicolas Pitre Cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, maennich@google.com, kernel-team@android.com Subject: Re: [PATCH] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS Message-ID: <20200129173714.GA193443@google.com> References: <20200129150612.19200-1-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 29 Jan 2020 at 12:11:12 (-0500), Nicolas Pitre wrote: > > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > > index a904bf1f5e67..1a6f7f377230 100755 > > --- a/scripts/adjust_autoksyms.sh > > +++ b/scripts/adjust_autoksyms.sh > > @@ -48,6 +48,7 @@ cat > "$new_ksyms_file" << EOT > > EOT > > sed 's/ko$/mod/' modules.order | > > xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | > > +cat - $CONFIG_UNUSED_KSYMS_WHITELIST | > > This is a nice trick, however it'll fail if the file path contains > spaces or other shell special characters. Argh! Right, that's a very good point. > You could try something like > this: > > [ -z "$CONFIG_UNUSED_KSYMS_WHITELIST" ] \ > && whitelist= \ > || whitelist="\"$CONFIG_UNUSED_KSYMS_WHITELIST\"" > > And then... > > eval cat - $whitelist | ... > > This way, if $CONFIG_UNUSED_KSYMS_WHITELIST is non empty, it'll get > quoted. A shorter alternative would be something a little like so perhaps ? diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 1a6f7f377230..8e1b7f70e800 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -48,7 +48,7 @@ cat > "$new_ksyms_file" << EOT EOT sed 's/ko$/mod/' modules.order | xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | -cat - $CONFIG_UNUSED_KSYMS_WHITELIST | +cat - "${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" No strong opinion, though. Thanks for the review, Quentin