Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9355147imu; Wed, 5 Dec 2018 03:31:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/XXbKF/lGFcGDe5cDvfLQcWnjDt/fOJ9TTm0pQAY2Qr4Ghj2D3iADG7C5Idsno016je3d7s X-Received: by 2002:a17:902:9305:: with SMTP id bc5mr14991906plb.86.1544009488002; Wed, 05 Dec 2018 03:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544009487; cv=none; d=google.com; s=arc-20160816; b=PP1fkpShbrmIRBUxvR8F0lrJRhUf6BeNL0So2ysw28h4vj0KMCM+bUuxRhEBo9WytL 8g25v/qmZ+fbI7EiUNmHKlG8Q0ZAb9c9X49ee+ROY2iXBcwwgpWdXtvqfK0eF4bXPtXC r+kbpuiXtCLIqVyj7lmDKT5Q+qqQUW4dRwX430AkjBhv2NvXGRfLfKmOi30pp8OcP5UZ BqTWXZljoA/46gI5cpR4eASV60ZmKLkCxY+UKrG578XrtaENMBG7bzWw3DO/9PJmvKwD pZK5FPu5Ayi8uXzU2G3GWjOtvV50W5da03nWnt2BHZi2GXFo6uQbiVrsIEjOj2hNFXu8 hCeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=H36yvD8LOqrJ4DjVGlwvJ7B2rd10VOZDsz4ulX8ISz4=; b=PqDr4cp1xiIbJabZX1yE4Cvlvfxu3HytBkBgT6PHY5piWb/CyxFKI9cWC2jJcxa2cU QegHoOSOytj2An/mTzfbZhsGmN+75GQw0tASQdS443L0kC/nrLE6GnbuJjTKiJX+ujrd 29+hFe3ak+0UhfHbkgq8FeHZB/1GS1jyf2oVeEu2dQ155LCquvwdnm+LA7uyK7jf/Emh fLWyg3/n9rO2fqwBYMmOWs/p9oimJftRe8bSd28Zy0qNEspS7sSAMZw2NNc6eLh1KVoj 2X1jxJNUEFIyXRXZB4p5I9+McmOVK5trzMD+vhqIlm0Um7vfHjFHf9bZ7bVOygDBbTM3 AhKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nUcDnLH0; 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 q5si18327107pgk.46.2018.12.05.03.31.12; Wed, 05 Dec 2018 03:31:27 -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=nUcDnLH0; 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 S1727725AbeLEL3X (ORCPT + 99 others); Wed, 5 Dec 2018 06:29:23 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:58256 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbeLEL3W (ORCPT ); Wed, 5 Dec 2018 06:29:22 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wB5BSBlW028064; Wed, 5 Dec 2018 20:28:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wB5BSBlW028064 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544009292; bh=H36yvD8LOqrJ4DjVGlwvJ7B2rd10VOZDsz4ulX8ISz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUcDnLH0CqUfD05RzSYxzCgBpv1ctmbz+Nvtqu/kBHV441FxN5rG1c9VHyi92EmGe YtIAoHxKvFy7Jrx7YUphXGLquRTXkrsCmSWAv8KMZ0mutCzYSt5UuqVtxFMaIRJ6QU SIq57KMcQRQX+MHu646R1r5JtAE3aKqe5JHwCWd3e48XrveCukWIYqlSIl7VUju+8B g07upgCR78yaz9Q2fvr/X6UCLhlYUs+AUyHTzsXA1SLdo/KIObYY34a36I34kIGl0g DqT1h7SFcFhm9o5ss3XUTJidJ0c4mm5pjyeyqsQx3mi26pmcTP83p8zNgKFAGDCLRt 5R9VMjYqnWvHQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Michal Marek Subject: [PATCH 2/3] kbuild: generate asm-generic wrappers if mandatory headers are missing Date: Wed, 5 Dec 2018 20:28:05 +0900 Message-Id: <1544009286-15705-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544009286-15705-1-git-send-email-yamada.masahiro@socionext.com> References: <1544009286-15705-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some time ago, Sam pointed out a certain degree of overwrap between generic-y and mandatory-y. (https://lkml.org/lkml/2017/7/10/121) I a bit tweaked the meaning of mandatory-y; now it defines the minimum set of ASM headers that all architectures must have. If arch does not have specific implementation of a mandatory header, Kbuild will let it fallback to the asm-generic one by automatically generating a wrapper. This will allow to drop lots of redundant generic-y defines. Previously, "mandatory" was used in the context of UAPI, but I guess this can be extended to kernel space ASM headers. Suggested-by: Sam Ravnborg Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 9 ++++++--- scripts/Makefile.asm-generic | 3 +++ scripts/Makefile.headersinst | 7 ------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 8da26c6..bf28c47 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -1296,9 +1296,12 @@ See subsequent chapter for the syntax of the Kbuild file. --- 7.4 mandatory-y - mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm - to define the minimum set of headers that must be exported in - include/asm. + mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild.asm + to define the minimum set of ASM headers that all architectures must have. + + This works like optional generic-y. If a mandatory header is missing + in arch/$(ARCH)/include/(uapi/)/asm, Kbuild will automatically generate + a wrapper of the asm-generic one. The convention is to list one subdir per line and preferably in alphabetic order. diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 760323e..c7cd23d 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -14,6 +14,9 @@ src := $(subst /generated,,$(obj)) include scripts/Kbuild.include +# If arch does not implement mandatory headers, fallback to asm-generic ones. +generic-y += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f))) + generic-y := $(addprefix $(obj)/, $(generic-y)) generated-y := $(addprefix $(obj)/, $(generated-y)) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index d5e1314..0d4a96d 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -57,13 +57,6 @@ check-file := $(installdir)/.check all-files := $(header-files) $(genhdr-files) output-files := $(addprefix $(installdir)/, $(all-files)) -ifneq ($(mandatory-y),) -missing := $(filter-out $(all-files),$(mandatory-y)) -ifneq ($(missing),) -$(error Some mandatory headers ($(missing)) are missing in $(obj)) -endif -endif - # Work out what needs to be removed oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders)) -- 2.7.4