Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp885873ybl; Fri, 31 Jan 2020 09:43:12 -0800 (PST) X-Google-Smtp-Source: APXvYqw2s0zOWIE5eMMPZDWGRrjIZDAtZrz5Z0yo19CBpuAF5y4bAS754J3b0WwsCaHzC+HPVmXG X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr8012415otd.372.1580492591954; Fri, 31 Jan 2020 09:43:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580492591; cv=none; d=google.com; s=arc-20160816; b=l6/IZ9krmQG4qQNMjX6hBwyogCUXVTc26jIShC/ygyw01Nm+kx+c/d+7YWLMY5Us6G BbRdlRN662uAX4mpxP5SSYGYrGvRKazqIRiZaksYufb96CS2TkMZdr2eXBtMQ039zzBX xm8P4l7eB8eN0Y0lbJv90CZp95AVL9MFwxcwC7ZSsCVQXC8zKXzPjx4dGPSj30YBopid p9IrkRvsjl3oRj9LBmrUPGFE2k/2gYUXKJaPFT3azfd2qiRylxIYfoqK406NQ2oqBiRF PnM8/A6LM5IBQVNiwHXA4eheiDulUgnN03wt9pHskg3UXSizmAIzGzNM9CyFZ44Y5VrN OFUw== 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=dB53pippwc9Cw99NKYUYznHPUB2hFZaxJZFvVBO7aqs=; b=VmeUSHSkIkEH/4kSBZyn5Z2TZ43Z07MXsXKCVkreEHfUmLxZ/sdt3JuPMK/DHFPV47 6ZX5rCOG8kJjiqKNamP8lenDSjVM8wuzNWPAKjZylIxjlKxPbicKBrN3RgBCzlFI1E7K jcJda5gKHbGWTlGd/chgNgvhdc3wpWk+Cb51k0nv8dBqJPBR7Yenbm7YiUC+GfovPDDj Psj14yQRFCqBdv4cvA/spgtpyRvSN67oMiDBErDNDpnvfs3ZReyxxHgXihml1t60qvUZ E1iSPJTOn5ef56T9uA40KGdIUCb8uGtGoRBuZEGkGFmoZVaVBuSgI1gzpQ/zFgZ8b/MD 4dWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qpA5X10B; 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 t16si5296432oth.38.2020.01.31.09.42.57; Fri, 31 Jan 2020 09:43:11 -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=qpA5X10B; 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 S1726969AbgAaRlB (ORCPT + 99 others); Fri, 31 Jan 2020 12:41:01 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33109 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbgAaRlB (ORCPT ); Fri, 31 Jan 2020 12:41:01 -0500 Received: by mail-wr1-f67.google.com with SMTP id b6so9709469wrq.0 for ; Fri, 31 Jan 2020 09:41:00 -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=dB53pippwc9Cw99NKYUYznHPUB2hFZaxJZFvVBO7aqs=; b=qpA5X10BTpYcTnqANydfOePRDFfM5juSOr2qFtgr27XSiXpOSD0IScgAJEwmmd3JpW DUGpMKZH52zTS/SqVObyGMJamkdBaepDzrxfRSKKSx70INGNrdfrqBEybgcz3N3+Trxb tprd/87tUYHn7uS2VA4tKsORGaWUnAvXKEJKYKxc4Keq+CSauqjMeo6m+Ah09LWtRfGp jqBpJXT8XRN08SMdk8ZdtzHdPYWtsi45xHulVXlPB0Tjx/IrgEpbLeCDeFV61E5iHvvd GBTg+gJbhlZtRsq9tomfDlWJ+vJYk2QLTg7E53cAy6ahljt/PvLoiQaWmO/vUtJdyMqU ZXqQ== 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=dB53pippwc9Cw99NKYUYznHPUB2hFZaxJZFvVBO7aqs=; b=JZ+sEo9NwftvFsgs5UGDUT8yS7JfKvxO3hDfd+6KEihkrb6awedPMHQ8QbG2p0r71V zRJZdBLv0T0Fp4ItkfhZbCCw7vhTzTarIfCAiqcgeB51kHvAjjVsdJfSuwta1dc+QXHz UjP8Tj/v63HaIuxEtIJ8nPduOpN3oj1EvAxpxXKYEqyeF9a49hsVM/oku5OEOGMUsV/D /pHfrWJtwPlMrKD9mwRmm5kKuFMkjlW2rzphgVs0bFiq4FsrEdfl6ANBnOkt3iYfTRvb +f2Yu58RD5saspxI9cvJPRuVH3Ce7/tynYMkziCrCHdi0Hb3Q+RwBQ7sZhWs4XM/HDDu epFg== X-Gm-Message-State: APjAAAW5Gw0Tsoz5TkiGza0JpcfWGgGUyV5/ndxcdScnQ1YDL83lCLiD 3V3NCjdwLlmcKFSRkBuCNFduSg== X-Received: by 2002:a5d:6a52:: with SMTP id t18mr13205891wrw.391.1580492459005; Fri, 31 Jan 2020 09:40:59 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id 21sm11359594wmo.8.2020.01.31.09.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 09:40:58 -0800 (PST) Date: Fri, 31 Jan 2020 17:40:55 +0000 From: Quentin Perret To: Matthias Maennich Cc: masahiroy@kernel.org, nico@fluxnic.net, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, kernel-team@android.com, jeyu@kernel.org Subject: Re: [PATCH v2] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS Message-ID: <20200131174055.GA8425@google.com> References: <20200129181541.105335-1-qperret@google.com> <20200131131508.GH102066@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200131131508.GH102066@google.com> 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 Friday 31 Jan 2020 at 13:15:08 (+0000), 'Matthias Maennich' via kernel-team wrote: > On Wed, Jan 29, 2020 at 06:15:41PM +0000, Quentin Perret wrote: > > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > > index a904bf1f5e67..8e1b7f70e800 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:-/dev/null}" | > > This handles absolute paths very well. I wonder whether we can make this > more useful for folks that want to maintain such a whitelist in their > copy of the tree. Lets say, I have in my sources > arch/x86/configs/x86_64_symbol_whitelist and in my config I have > CONFIG_UNUSED_KSYMS_WHITELIST="arch/x86/configs/x86_64_symbol_whitelist". > > If I see it correctly, UNUSED_KSYMS_WHITELIST is currently either an > absolute path or a relative path to the current build directory. I would > prefer if relative paths would be relative to the source directory to > support the above use case. (Note, that scenario above works if I build > directly in the sources, but fails if I build O=/somewhere/else.) Right, that is an interesting use case. I suppose something like the below should work (with appropriate documentation of the config option). ---8<--- diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 8e1b7f70e800..d37803fd75ce 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -38,6 +38,12 @@ esac # We need access to CONFIG_ symbols . include/config/auto.conf +ksym_wl="${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" +# If the path is relative, it must be relative to the source tree +if [ "$ksym_wl" == "${ksym_wl#/}" ]; then + ksym_wl="$abs_srctree/$ksym_wl" +fi + # Generate a new ksym list file with symbols needed by the current # set of modules. cat > "$new_ksyms_file" << EOT @@ -48,7 +54,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:-/dev/null}" | +cat - "$ksym_wl" | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" --->8--- Thoughts ? Thanks, Quentin