From patchwork Fri Mar 16 02:18:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131891 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp179131ljb; Thu, 15 Mar 2018 19:20:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELuNq5BsMLdJrxa6oEMAMra+LnGgWEXoYKh/KdZupmkG/dpSSkip+NwBMOhEimPMlVp+MT6+ X-Received: by 2002:a17:902:bc04:: with SMTP id n4-v6mr131902pls.97.1521166806570; Thu, 15 Mar 2018 19:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521166806; cv=none; d=google.com; s=arc-20160816; b=MouLkmHmvL3vwWhxvS6JImXfq1M66eHGZsS/XYG7de5MADL8W9HunpTN+o/O/P1qlW y7+i92U7kyNnBjsqrUWeEBGbHvhVsYftHj6TYGLTz6gTKastbuNjRRnQr41Hw3PwAIKz uRx271PjZHtguSeQe1R7ua6xCu8GyuSOE5OtXe8JK1vPCJsZkcnGYAmj21RpMXO507sg +0pWndwuyj/I5F7qss7lBQcsICscUNpJJRzA9RSsXGyAU3UD1qTEoxxJrQqLUO/P1M6E L8c6WqS2Qp/aa2fKVP7UMYmEUu4viOYKZ0jIm6LDcMju8pfHWSDmCHnkY6dcTgv2bkJ4 3Xqg== 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 :arc-authentication-results; bh=VUYZS69VGB2nPrN8Foh6xMoy29EhI+wdMka0ZLIUg1Q=; b=VQLm+xFzQKbOckOdAhy/a0cD5XnZhjhD9Hhi0PMXDOHZwp82ovn8wPPt/PeJPx6Z/j pwpD/nD3czROP1oGuhvMZInSAOAvGP2/eorh+OI3lfkhhxJX8JdgOlJmhunwULsyJOHx AOIelXVoCrBGX24aDjOtgkL0Gzs3SlB3dG3BUEUb1jeBG27HOto8/yguaUU+LkyA06nS oA497p0+JsTsAi6uDqHYG5rT8qxhJXE7WnjV4uZQhKcHE6E60ajf4d85bjGFUVYKWB4n JbivCPkmPmuBBx5PkruV4u/ARpaRLmOnuFzkrYZFqTO/Ga69u8p/CFcBjbXjMzh5DBzY Up3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0KkM2maG; 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 j15si4267059pgv.676.2018.03.15.19.20.06; Thu, 15 Mar 2018 19:20:06 -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=0KkM2maG; 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 S932938AbeCPCUB (ORCPT + 28 others); Thu, 15 Mar 2018 22:20:01 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:44535 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbeCPCTM (ORCPT ); Thu, 15 Mar 2018 22:19:12 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id w2G2IoBP003525; Fri, 16 Mar 2018 11:18:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com w2G2IoBP003525 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521166734; bh=VUYZS69VGB2nPrN8Foh6xMoy29EhI+wdMka0ZLIUg1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0KkM2maGhm7O4PB+dbdo/IPtt5v0Xk04HlRwr8wKxCxl6sT0aqrEjeP3D6Fg94y4F OHK8QihvBtGfNI8bK2hJ/BlkbblJZ/Z5lJsfxY09J5UJB1nbheGqMoTNakWfJNMMdd cLHNjgbEfq/3AN3PQh94dCEHTOhuYbpGBwPdptmOp8vI+zlFLWFZshgmfJRxB4zHhj 0Kk0+/ahW//PokLsHAzId+glItA4VF3KyBfsZOoO3ReGlnCvHVstrHnGl/hdOgb6DO /Di+7Grxm/byAxI4TR/0ZKjqnjE2o/gkm0m4BJv6ycLKcvRPFFltxOfjbXnkvoaaF7 Eyhx/UaJIoeIA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] kbuild: restore touching autoksyms.h to the top Makefile Date: Fri, 16 Mar 2018 11:18:41 +0900 Message-Id: <1521166725-24157-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521166725-24157-1-git-send-email-yamada.masahiro@socionext.com> References: <1521166725-24157-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 Commit d3fc425e819b ("kbuild: make sure autoksyms.h exists early") moved the code that touches autoksyms.h to scripts/kconfig/Makefile with obscure reason. >From Nicolas' comment [1], he did not seem to be sure about the root cause. I guess I figured it out, so here is a fix-up I think is more correct. According to the error log in the original post [2], the build failed in scripts/mod/devicetable-offsets.c scripts/mod/Makefile is descended from scripts/Makefile, which is invoked from the top-level Makefile by the 'scripts' target. To build vmlinux and/or modules, Kbuild descend into $(vmlinux-dirs). This depends on 'prepare' and 'scripts' as follows: $(vmlinux-dirs): prepare scripts Because there is no dependency between 'prepare' and 'scripts', the parallel building can run them simultaneously. 'prepare' depends on 'prepare1', which touched autoksyms.h, whereas 'scripts' descends into script/, then scripts/mod/, which needs if CONFIG_TRIM_UNUSED_KSYMS. It was the reason of the race. I am not happy to have unrelated code in the Kconfig Makefile, so getting it back to the top Makefile. I removed the standalone test target because I want to use it to create an empty autoksyms.h file. Here is a little improvement; unnecessary autoksyms.h is not created when CONFIG_TRIM_UNUSED_KSYMS is disabled. [1] https://lkml.org/lkml/2016/11/30/734 [2] https://lkml.org/lkml/2016/11/30/531 Signed-off-by: Masahiro Yamada Acked-by: Nicolas Pitre --- Changes in v2: None Makefile | 12 +++++++----- scripts/kconfig/Makefile | 2 -- 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index f8e9e12..0a3895c 100644 --- a/Makefile +++ b/Makefile @@ -1021,9 +1021,11 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS "$(MAKE) -f $(srctree)/Makefile vmlinux" endif -# standalone target for easier testing -include/generated/autoksyms.h: FORCE - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true +autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) + +$(autoksyms_h): + $(Q)mkdir -p $(dir $@) + $(Q)touch $@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) @@ -1067,7 +1069,7 @@ include/config/kernel.release: include/config/auto.conf FORCE # in parallel PHONY += scripts scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ - asm-generic gcc-plugins autoksyms + asm-generic gcc-plugins $(autoksyms_h) $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1097,7 +1099,7 @@ endif # that need to depend on updated CONFIG_* values can be checked here. prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic -prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ +prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 78c96aa..f9bdd02 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -38,8 +38,6 @@ nconfig: $(obj)/nconf # for external use. syncconfig: $(obj)/conf $(Q)mkdir -p include/config include/generated - $(Q)test -e include/generated/autoksyms.h || \ - touch include/generated/autoksyms.h $< $(silent) --$@ $(Kconfig) localyesconfig localmodconfig: $(obj)/conf