Received: by 10.213.65.68 with SMTP id h4csp1582688imn; Thu, 15 Mar 2018 04:03:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELuLCwjK4HiByugVT2jAZ2bcIP12bcctQdM549eWJQArtcARQ4dSVuGnFecMAzW2u+dBSiC2 X-Received: by 2002:a17:902:82c2:: with SMTP id u2-v6mr7440532plz.401.1521111833072; Thu, 15 Mar 2018 04:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521111833; cv=none; d=google.com; s=arc-20160816; b=hIsXM9aHNBshnj9vMl6potuIHbT0zx1PCNynlkj32upbTr7y7pFWhKae6WOgvbVqfW hc6C+UGEgKqboVBuRTBe6mJBup2GsLOKuaxlN/a9fcB0N+yT0Kn3g/dKE5BeYM8sy4C/ AdzN5oiCZ3M9gaSmfvYfDP1Jyz2o72xWV8h0Gc/ughda4dTl4Z2u4Kq+zWnI6qZRPBrK lF8AkxU5dWKLOF1DJVs5viqpEs8xiae69BXMbGoXG+flqTW6DL4c6dtRj5JSaDF06tAv sTsesymV0swVfvZ6wlzpTlT3lfjzjYg4T18lezWJfuYGvG5gH17qyFLxcbN7AP10FfaK 4JTA== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=M2+T8N+naFEz9i98LfyeOnK7FMEan0zx9uvnOQe3H1Y=; b=voT30SHMJdrrOByPnQ23L2y6irf0Ze6XYyjcq/boCANi7pvjyN6LSNJ9tx0pPCWiEx l4IIO6BiIcF88aau+BfK6o3kwR4JWfrbBbhNjoAuOe9GPAOEE2nOoWY4FM22TRBxoqIv DDoz84YhFxIzUdY6ymCYo9fRzPPqA+043YTiqsqmw5gKi9A6GOg3A5ryIIJbwCGAB0AQ KdwSTGuDAXzZulzFbsch1wHFNVBeFmjXF1K5uyrKvlcnZdGBfMHbQrmF4EUTOeLNHAZL NkivwF+pbJp0IXBMVzz18uI2hR2whIMXe8+/bOq3uS17Y2kz+VNZfoSlhP28teMJ8a1f T85A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=C5wAUP/e; 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 q8si3343513pgs.203.2018.03.15.04.03.38; Thu, 15 Mar 2018 04:03:53 -0700 (PDT) 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=C5wAUP/e; 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 S1752189AbeCOLC0 (ORCPT + 99 others); Thu, 15 Mar 2018 07:02:26 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:61382 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbeCOLCE (ORCPT ); Thu, 15 Mar 2018 07:02:04 -0400 Received: from mail-vk0-f43.google.com (mail-vk0-f43.google.com [209.85.213.43]) (authenticated) by conssluserg-06.nifty.com with ESMTP id w2FB1mXW008170; Thu, 15 Mar 2018 20:01:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com w2FB1mXW008170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521111709; bh=M2+T8N+naFEz9i98LfyeOnK7FMEan0zx9uvnOQe3H1Y=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=C5wAUP/eVIrl6W2YVv8heSoJIBDZfQDFPPzHaU4w1xSAU5V/M+Ln/ghGJQoEnFXX7 xb80ko2v+s87fMeywx6EhxcZiFuAkD/mmEJ0yKxyZFFu42VNg0qhDDPdAkvW90w0Jq nQVSveu+6kQuMExtfKiHmbSWzBU8m/OD7G1GnZutr14HnFb3YcnKYGjj3Ss03F6l/m J7sg8eIvhyqe6Ls/Gkm0RznNOn5E+XyQutn/faTp2htKX/LCuYShs2V2VEDfF4IL9o FiWshS8mcsKp6zi5RoxOh8Otn2bhussHr0aFAEtnu1b/Tbd/Urvy+AD8RYYn2VpCMl 4v+wEC3lzSsIg== X-Nifty-SrcIP: [209.85.213.43] Received: by mail-vk0-f43.google.com with SMTP id s1so3904551vke.5; Thu, 15 Mar 2018 04:01:49 -0700 (PDT) X-Gm-Message-State: AElRT7Fb8pyyVwsqtmib1rRVEob1uQ6L6rEg9Ap0h9v0DDVjHw6zE1wf koaKmNVrtZfyzedZyX4ggk+p7R+pKSqjUxpFhGw= X-Received: by 10.31.68.135 with SMTP id r129mr5592353vka.160.1521111707951; Thu, 15 Mar 2018 04:01:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.32.138 with HTTP; Thu, 15 Mar 2018 04:01:07 -0700 (PDT) In-Reply-To: References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> <1521045861-22418-7-git-send-email-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Thu, 15 Mar 2018 20:01:07 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 6/7] kbuild: move include/config/ksym/* to include/ksym/* To: Nicolas Pitre Cc: Linux Kbuild mailing list , Jarod Wilson , Prarit Bhargava , Michal Marek , Linux Kernel Mailing List 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 2018-03-15 19:04 GMT+09:00 Masahiro Yamada : > 2018-03-15 3:47 GMT+09:00 Nicolas Pitre : >> On Thu, 15 Mar 2018, Masahiro Yamada wrote: >> >>> The idea of using fixdep was inspired by Kconfig, but autoksyms >>> is unrelated to Kconfig. So, I want to get those touched files >>> out of include/config/. The directory include/ksym/ is removed >>> by "make clean". We do not need to keep it for external module >>> building. >> >> It could be argued that include/config/ is not strictly containing >> configuration data either and is slightly misleading. > > But, slightly related to configuration, IMHO. > At least they carry timestamps that are updated > when kernel configuration is changed. > > The difference between include/config/ and include/ksym/ is that > files under include/config/ are necessary for building > external modules (so should be cleaned away by mrproper) > whereas include/ksym/ is unnecessary for external modules > since vmlinux and in-kernel modules do not depend on > external modules. > > > I wonder if trimming symbols makes sense for external modules. > > EXPORT_SYMBOL(_GPL) in external modules are always trimmed > since vmlinux and in-kernel modules never rely on them. > > If an external module exports symbols, > it expects they will be used by other external modules. > > So, the patch like follows make sense? > > > > > kbuild: do not trim symbols in external modules > > diff --git a/Makefile b/Makefile > index 0a7bab6..bdf565e 100644 > --- a/Makefile > +++ b/Makefile > @@ -998,6 +998,7 @@ autoksyms_recursive: $(vmlinux-deps) > # (this can be evaluated only once include/config/auto.conf has been included) > ifdef CONFIG_TRIM_UNUSED_KSYMS > KBUILD_MODULES := 1 > + export KBUILD_TRIM_UNUSED_KSYMS := 1 > endif > > autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include > index 045971e..3249d5f 100644 > --- a/scripts/Kbuild.include > +++ b/scripts/Kbuild.include > @@ -345,7 +345,7 @@ if_changed_dep = $(if $(strip $(any-prereq) > $(arg-check) ), \ > @set -e; \ > $(cmd_and_fixdep), @:) > > -ifndef CONFIG_TRIM_UNUSED_KSYMS > +ifndef KBUILD_TRIM_UNUSED_KSYMS > > cmd_and_fixdep = \ > $(echo-cmd) $(cmd_$(1)); \ > > > > >> What about moving include/config/ and include/ksym/ under >> include/depfiles/ ? In fact that could even be >> include/generated/depfiles/config/ and include/generated/depfiles/ksym/ >> to trim down the top include directory. >> >>> Signed-off-by: Masahiro Yamada >>> --- >>> >>> .gitignore | 1 + >>> Makefile | 2 +- >>> scripts/Kbuild.include | 2 +- >>> scripts/adjust_autoksyms.sh | 2 +- >>> scripts/basic/fixdep.c | 8 ++++---- >>> 5 files changed, 8 insertions(+), 7 deletions(-) >>> >>> diff --git a/.gitignore b/.gitignore >>> index 1be78fd..85bcc26 100644 >>> --- a/.gitignore >>> +++ b/.gitignore >>> @@ -87,6 +87,7 @@ modules.builtin >>> # >>> include/config >>> include/generated >>> +include/ksym >>> arch/*/include/generated >>> >>> # stgit generated dirs >>> diff --git a/Makefile b/Makefile >>> index e60b16f..1dab647 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -1327,7 +1327,7 @@ endif # CONFIG_MODULES >>> # make distclean Remove editor backup files, patch leftover files and the like >>> >>> # Directories & files removed with 'make clean' >>> -CLEAN_DIRS += $(MODVERDIR) >>> +CLEAN_DIRS += $(MODVERDIR) include/ksym >>> >>> # Directories & files removed with 'make mrproper' >>> MRPROPER_DIRS += include/config usr/include include/generated \ >>> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include >>> index 065324a..045971e 100644 >>> --- a/scripts/Kbuild.include >>> +++ b/scripts/Kbuild.include >>> @@ -368,7 +368,7 @@ ksym_dep_filter = \ >>> $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ >>> boot*|build*|cpp_its_S|*cpp_lds_S|dtc|host*|vdso*) : ;; \ >>> *) echo "Don't know how to preprocess $(1)" >&2; false ;; \ >>> - esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' >>> + esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/\1/p' >>> >>> cmd_and_fixdep = \ >>> $(echo-cmd) $(cmd_$(1)); \ >>> diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh >>> index a52210b..7bb3618 100755 >>> --- a/scripts/adjust_autoksyms.sh >>> +++ b/scripts/adjust_autoksyms.sh >>> @@ -81,7 +81,7 @@ sort "$cur_ksyms_file" "$new_ksyms_file" | uniq -u | >>> sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" | >>> while read sympath; do >>> if [ -z "$sympath" ]; then continue; fi >>> - depfile="include/config/ksym/${sympath}.h" >>> + depfile="include/ksym/${sympath}.h" >>> mkdir -p "$(dirname "$depfile")" >>> touch "$depfile" >>> echo $((count += 1)) >>> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c >>> index 449b68c..f387538 100644 >>> --- a/scripts/basic/fixdep.c >>> +++ b/scripts/basic/fixdep.c >>> @@ -113,11 +113,11 @@ static void usage(void) >>> /* >>> * Print out a dependency path from a symbol name >>> */ >>> -static void print_config(const char *m, int slen) >>> +static void print_dep(const char *m, int slen, const char *dir) >>> { >>> int c, i; >>> >>> - printf(" $(wildcard include/config/"); >>> + printf(" $(wildcard %s/", dir); >>> for (i = 0; i < slen; i++) { >>> c = m[i]; >>> if (c == '_') >>> @@ -140,7 +140,7 @@ static void do_extra_deps(void) >>> fprintf(stderr, "fixdep: bad data on stdin\n"); >>> exit(1); >>> } >>> - print_config(buf, len - 1); >>> + print_dep(buf, len - 1, "include/ksym"); >>> } >>> } >>> >>> @@ -208,7 +208,7 @@ static void use_config(const char *m, int slen) >>> return; >>> >>> define_config(m, slen, hash); >>> - print_config(m, slen); >>> + print_dep(m, slen, "include/config"); >>> } >>> >>> /* test if s ends in sub */ >>> -- No. All exported symbols in external modules are still trimmed. Hmm. Probably, this is a "Do not do it" thing. -- Best Regards Masahiro Yamada