From patchwork Fri Mar 16 07:37:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131912 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp411495ljb; Fri, 16 Mar 2018 00:39:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELv1hm0QKxHM8rTp71JY6xzzNOEdoWgm3tH2KVy9yPfILrp90ZoE07vOyyWcYn+YLkGC9v6Z X-Received: by 10.98.21.200 with SMTP id 191mr752273pfv.166.1521185946657; Fri, 16 Mar 2018 00:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521185946; cv=none; d=google.com; s=arc-20160816; b=nG9pf7LgGmY34zdZdFo+7uMJVSh1+1y+WUr8FUbY3/3VaQs8/P4FeTdXYVZN0PxKny 3Kh2Ff4kD78FGY5jttHQgGUkh0O/AiSrtbpFDod4eVxPcKypdYRJ4686/WftgPiQ7CEZ uQRCiSyw2vEn41+0vk5uX1+OK2PJGXxnpjRSzJqYwMMn0tIqRpaQyU35ibCtlnZ5uRBh abs1438gypGQwhkkOHBfLOnDdQCQJKpxWGUHxf45oj2fWPQbCBR+kiWrdfupev+wYH2Y YvQXq2AL+EKQYa0MpKVGx5zkPQw6NtDAORaO+3G51jiL/MyMkV0Vpxl8aA12lRwxBgDc OwdA== 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=MuisgIpmlDMDI+IC/CFiiC+PiXrOXm9lnHNf6pfMiSo=; b=BN2i2/0jSb8DFCrztwCdnK1m7lSN1+oiQFTPs/ssVCfbyZU+fnUgYRt5k5HduVkx+k qLGbLI8tD2VxfsRXqs6ADiMb8E1UJdJkRTdTQCCVDObbOgUDuRif7scOK8ncMWpq3RNh Qriarr0tQID0Tle+Ue4WVFBK3x6UQ7vIhY8A0MXbqmxS1JDVrMeSWz0wgKTSlVMxijwf iyS4mYaivQySqLG1/IVoir7Ym6riTReinlihV+tlB3ZkB8KJQd5fTn1fPTA9/glu1FOO u+XO+/NybPAbpNAGVOZeaeHgikvv0I40FhWs0kofzGg35Z+LtkiFkiRROvxHTanezisQ RX0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tZfqWVih; 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 m63-v6si5780016pld.602.2018.03.16.00.39.06; Fri, 16 Mar 2018 00:39: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=tZfqWVih; 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 S1753299AbeCPHhr (ORCPT + 28 others); Fri, 16 Mar 2018 03:37:47 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:20641 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeCPHhn (ORCPT ); Fri, 16 Mar 2018 03:37:43 -0400 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 w2G7bOa7029139; Fri, 16 Mar 2018 16:37:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2G7bOa7029139 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521185849; bh=MuisgIpmlDMDI+IC/CFiiC+PiXrOXm9lnHNf6pfMiSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZfqWVihiFJl0lTZPSoyRA2NOVmIe/zkCczLs/IAlKmZUWu6Vde72FoOhEJDyN2Al PGUx2nPwamlG28ciCCMJlmMLEHcCnW9PUwxImZxyOqBLA1qk9G6kwKCrO1i1vosPUO +T4vIq5qHz69hgocCDrs1uPQ0s9my7b0sM5FXWGMqS2CkunQIX6d5JxA3MkU7AXJWl CKw2nyNc47KT4rRhXpl/AjPOjthoIK7YTZtJCfA2YQvJSX48CBeHEAVqceLQLRc+mV M//8Q/tJwHqIn5kzHGTeJgqGjw3iLk+RQTidx5afc82zD5WxXrhdfBtmNcuirf0eda F4Itl2QWIuz+A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Michal Marek , Nicolas Pitre , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v4 4/7] kbuild: restore touching autoksyms.h to the top Makefile Date: Fri, 16 Mar 2018 16:37:12 +0900 Message-Id: <1521185836-19120-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521185836-19120-1-git-send-email-yamada.masahiro@socionext.com> References: <1521185836-19120-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 v4: None Changes in v3: None 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 9bf6697..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 + 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