Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp893092ybv; Fri, 7 Feb 2020 10:23:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyXdJz81O3bD0iDV6GGkJ8jYtdAi1rPAQdsgArYcR7mOcOZxQuTW45kc06xBk46wWikB4UQ X-Received: by 2002:a9d:6a06:: with SMTP id g6mr454924otn.305.1581099803281; Fri, 07 Feb 2020 10:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581099803; cv=none; d=google.com; s=arc-20160816; b=qkoSBQkont2cRhp92soBgzzkDKrPVtwg5EHB8u4XPg2M3/Fu4YB48tqXdx7Agfw8h7 0HDJFwvjBr/QGhpcXjyXlurc44RNek5Qfuo7tRsxlVdlg7gcGmqn+S37b8iK2moQ+hMP LPwr0fVKoOg7qkK3+4U2m3cRMTSdKVsdEGSbZgMJ2hzuN/dFnApoCkCY2Xk7zgNLtksw PCbNrHFAkQe5zlmGFzAm9/RFSNru53s3vd2pS+Vm+8mECEMV4In1cNe2bVfQeboNE41G GIu4DwfUudqkEYFL+zMObQGnxtIiaOw3j3LeomYeyhzYK3kSQgMGj+cyRm048RNkHXty KFyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=vg+7LTr/Mm9MARvcatfxU7wtTif3E5DxWy1Yhzd9AJM=; b=z4Pd3wEK6WkX7PF7Q1t/tXwZqp2MUDUxcMCk0UqVB/MXD9sy0siLFDHMqNnJEYqAqS RUhvia3eU1+J46ISnfUsS9I52G/GosSXMjTbNFDErF2CoaAS6KBQdrFv+8MkEuyhI+tC 1AmWSrDCB+tJQ6fnu2oXadtVRioJeBmvt52kdoCmmg6LpPoS5wRLjkXfNr9qkVlFwXQK IWroIgFdkdfongY0N8wJBBe4tpm7r8lm0+2PqQxEatJD/LrL9l5q8Y9CM55u7NaX4CgT wzfKDzR+jZzV558qi8NuYMxoKkIwUS1qxQD/oP96fYNoQwLb4wyNTwk8a9P287QHBZzs vEAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=FEpwocI4; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=Vw7oQVfS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l140si4489150oib.114.2020.02.07.10.23.10; Fri, 07 Feb 2020 10:23:23 -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=@pobox.com header.s=sasl header.b=FEpwocI4; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=Vw7oQVfS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbgBGSWT (ORCPT + 99 others); Fri, 7 Feb 2020 13:22:19 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:55140 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbgBGSWT (ORCPT ); Fri, 7 Feb 2020 13:22:19 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 5208054BE5; Fri, 7 Feb 2020 13:22:14 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=9WMxIP/6iHc0Gn3chTdRzQ3KxHU=; b=FEpwoc I41pCIqAxDwVR86rLcehMVcqkyEXcM10jHEuTCdObNSYtEsbaQqITX1o40c63rti vOznHwvsVf3ljZ05dhXNhiZHn/X5YgTvkQT8LWGWXnmjHqOtQP88cbBYOu/os2o3 65KqrgZzMNl6AH7bWvpp5KljMyR0bd7IcKRv0= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4911754BE4; Fri, 7 Feb 2020 13:22:14 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=bjuIsYXrSyPas58NLMHos31uoWzRJgrzhJvJZEoIqKc=; b=Vw7oQVfScGIdW3D2Et32jFVqLSKE8uiAmdnnSax66r/GiJuQxfKmAGC7VTHZ3wQfGDw7vKta4bJThg3rMHHPcExE0jRL1lyGqODtmpDSnHAQCHLI24nCpe2VZa+5Lyf1UwlL4QO5/H6oK8T+2QJBNH9z1P9s7DOSq/ql7uBKuSY= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id BCBF854BE3; Fri, 7 Feb 2020 13:22:13 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id E72BD2DA095A; Fri, 7 Feb 2020 13:22:12 -0500 (EST) Date: Fri, 7 Feb 2020 13:22:12 -0500 (EST) From: Nicolas Pitre To: Quentin Perret cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, maennich@google.com, kernel-team@android.com, jeyu@kernel.org, hch@infradead.org Subject: Re: [PATCH v3 1/3] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS In-Reply-To: <20200207180755.100561-2-qperret@google.com> Message-ID: References: <20200207180755.100561-1-qperret@google.com> <20200207180755.100561-2-qperret@google.com> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: C36052A0-49D6-11EA-A75E-C28CBED8090B-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 7 Feb 2020, Quentin Perret wrote: > @Nicolas: I left your Reviewed-by behind as the code has changed a bit > but let me know what you think > --- > init/Kconfig | 13 +++++++++++++ > scripts/adjust_autoksyms.sh | 5 +++++ > 2 files changed, 18 insertions(+) > > diff --git a/init/Kconfig b/init/Kconfig > index a34064a031a5..79fd976ce031 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -2180,6 +2180,19 @@ config TRIM_UNUSED_KSYMS > > If unsure, or if you need to build out-of-tree modules, say N. > > +config UNUSED_KSYMS_WHITELIST > + string "Whitelist of symbols to keep in ksymtab" > + depends on TRIM_UNUSED_KSYMS > + help > + By default, all unused exported symbols will be un-exported from the > + build when TRIM_UNUSED_KSYMS is selected. > + > + UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept > + exported at all times, even in absence of in-tree users. The value to > + set here is the path to a text file containing the list of symbols, > + one per line. The path can be absolute, or relative to the kernel > + source tree. > + > endif # MODULES > > config MODULES_TREE_LOOKUP > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > index a904bf1f5e67..58335eee4b38 100755 > --- a/scripts/adjust_autoksyms.sh > +++ b/scripts/adjust_autoksyms.sh > @@ -38,6 +38,10 @@ 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" This "[[ ]]" is a bashism. I think there was an effort not to depend on bash for the build system. So either this needs to be changed to basic bourne shell, or the interpretor has to be /bin/bash not /bin/sh. Nicolas