Received: by 10.213.65.68 with SMTP id h4csp1106578imn; Wed, 14 Mar 2018 09:46:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELsjJVKDRX6N8pNQwfVp+Y+d9H22Jhjrhh/7+cvoi/ZU97Xc7KhPTAYgfItjmaKLH0bq/wvc X-Received: by 10.98.57.215 with SMTP id u84mr4825284pfj.152.1521045999249; Wed, 14 Mar 2018 09:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045999; cv=none; d=google.com; s=arc-20160816; b=g4MjQo3KxA+RQYpxOHKrPwdaMr+QM7LKEi9n7LIZdIocC+RHZ9DwVLYgss0M8BfPRV Zzh5BVWf9puVX+iNjRoCr1CHZVLgC6K3FdPyOC3BuBJ1/2xfROl1YNJO1Y35/WmyYlud DrXdFFFw9G7408azs4yvPabd7BYJybpfJgjS4ydyL8h+QJK9v+XDzxEJzRdBoerP9x+j 5bgoyZ1TeWTK7hfGAp8nNXfIUdIca8xTc9DI9nT53+DmWu5aGeU9onhhCY4edhBfJlQF nijwqqyWJm8UmLkOfc8n8GhxOMgQaE4EoQ5WGLkqE/35QQH0RXv6XtQocFXF+BbVwjXe ih6g== 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=XPg/051uhOYecD3z3Ngs9j9G5O7xXZ1sX8T2goNtKzE=; b=fT3Pz0LHLI32poMvXOY9ugCyF/WLRBGoXtmN6kGJ8fWzxpVCe89G8R4/Wvtckxurde Zy9ORdGmMXJ5/9INj9gE4oClHef3TczXbooK2S4yMrVX3M1KUUzkd2cSrS1UawBzO2Pc 81r0dX/1wPB33G/4bsRSPz/DLJHt1Ult5gJEF53L/6mmYKn0ik4hC8xxUObQF4GKYM40 ZZKMUiRuT0rMXXMM4FA5oZD+DFUa/UqVKcP8LcNMsC1cJ9Sr5Xcgj5vGMEdaF6wMJ7XC Z6UBPlGIsMrU1XLVbVFmQiuieM0Of+u8iWAQUVIwtJe4b4tPKx5Ui5+JQTxsSNTXf9Sm vhMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=G55HGPMG; 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 m39-v6si2221129plg.151.2018.03.14.09.46.24; Wed, 14 Mar 2018 09:46:39 -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=G55HGPMG; 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 S1752344AbeCNQoz (ORCPT + 99 others); Wed, 14 Mar 2018 12:44:55 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38074 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdT001049; Thu, 15 Mar 2018 01:44:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdT001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045871; bh=XPg/051uhOYecD3z3Ngs9j9G5O7xXZ1sX8T2goNtKzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G55HGPMGUnRKXoILJNMOcpdieRjT2lP/ZfVUojeP9Bb3VFveLCfI3mPi54vPyG/Dz rtUwLrmPcxYLhREIh7Gt5VCtnLPjhVOzyztPoHnkSrsZh1LxvHZWveJ7myY9EGzJ7p 1WzS0QkkFABnZlNDFURtCRbSNB0MOxd0Z38eSGMltgEihOR3SiG7EjDZz+khtY4EnQ zj+hkeuCrRjpeyvpP5sIOxZxwGVwpEfVuR/OxoP+yW/jpeBRI+/VrbU6HqtVNF3+D9 yXqMAaz1T4YsRVQ7oj2SdVvk//lZt+NSfAkxg6wdT/6fnPcz4DPsIP1PXYxJk5zE9L EaTYCYFhkTWQA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 4/7] kbuild: restore touching autoksyms.h to the top Makefile Date: Thu, 15 Mar 2018 01:44:18 +0900 Message-Id: <1521045861-22418-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-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 'script' 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 needed if CONFIG_TRIM_UNUSED_KSYMS. This was the reason of race. I am not happy to have unrelated code in the Kconfig Makefile, so getting it back to the top Makefile. I remove 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 Commit: The discussion happened in Nov. 2016. I was not involved in it. I was not the Kbuild maintainer at that time. END --- Makefile | 12 +++++++----- scripts/kconfig/Makefile | 2 -- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index fab0e19..decc870 100644 --- a/Makefile +++ b/Makefile @@ -1010,9 +1010,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) @@ -1056,7 +1058,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 @@ -1086,7 +1088,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 cb3ec53..eb139a1 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -38,8 +38,6 @@ nconfig: $(obj)/nconf # for external use. silentoldconfig: $(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)/streamline_config.pl $(obj)/conf -- 2.7.4