From patchwork Wed Sep 12 12:08:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 968975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CQeXVLXP"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="FGwMIR5D"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 429LDV250Xz9s3l for ; Wed, 12 Sep 2018 22:09:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:Message-ID:Date :Subject:To:From:Reply-To:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=t0fTs0RtulcFgfEIuWoSk8I636j2A6T9OFolh/P8Ip4=; b=CQeXVLXPvMKnYt RRznuJdC0tPcVIIM3sj2Rx09wG2cXH3ifHTVIcvjpQK7taC/zj+VMkRGlt9yDDAn3ovfqQo54zSkJ Dn0MuynYUe2E6PQvWlxfm7YMLGU4RgZFKVEYtFNtnO2BDpzbVqNsQXCYYHAAMxFGR8zIxN7PZouZT tGGNAIBJlRnUNsSmsji5X4/JMho5QqpKDHIkL4/uB/35gImmiEVfh8uVeKM1O6cNQ1+OiCY/3GCMe WJDuyqswJXHTUJmcHuPeICDnm8NjfsKrByIJlwPP/5Q52Ue7gXVjx5rkXh/51q1KStp3dS+ZdJMoV Okigeb2XlZ/rjz6D0TEg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g03xH-00063i-UW; Wed, 12 Sep 2018 12:09:11 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g03xE-00061r-Mx for linux-snps-arc@lists.infradead.org; Wed, 12 Sep 2018 12:09:10 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id A48A724E0F5D; Wed, 12 Sep 2018 05:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1536754135; bh=ThBM0TeqoJzzGvOYoUKpqZ+Yte9WV+4Nn5Sk0ZgOlQU=; h=From:To:CC:Subject:Date:From; b=FGwMIR5DY5d/m7ZyZPw7LjV8oPFCrThVsfUOjHyiOBWfJ3Nj0IrIwte2gjuHxtyE0 hpBxnASzmhgJYmQiemsDLDhQ/Tyby9zROBl8Ecxtk0JDnRR5DDXq3OHJdykqHdoWba /g4t2EH0hYDitV8pDB0IdzlNuFZ9GNhJt4n4NmiZLF7vBGj+Gc/hcMBcam0kH6Lx+D +0jE6BigQAlJIovWD1zr7mwTT++1pb0fiHYkXnWoXAfqVfoyPkZcbuZHxa0zFXfPBP rnfzBa7BMg0lzCU0dTD0KrPXWVWTHDz1eC2ZISW1RzexNUKglB0CGJsDZAq7DNMeah W5cz3nHq4aJgw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id B49193B5D; Wed, 12 Sep 2018 05:08:52 -0700 (PDT) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 12 Sep 2018 05:08:42 -0700 Received: from DE02WEMBXB.internal.synopsys.com ([fe80::95ce:118a:8321:a099]) by DE02WEHTCB.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Wed, 12 Sep 2018 14:08:41 +0200 From: Alexey Brodkin To: "yamada.masahiro@socionext.com" Subject: defconfig fails if CROSS_COMPILE is set while cross-gcc is not avaialble Thread-Topic: defconfig fails if CROSS_COMPILE is set while cross-gcc is not avaialble Thread-Index: AQHUSpFXS1S71sJSu0SpMEzLuj4Mhw== Date: Wed, 12 Sep 2018 12:08:40 +0000 Message-ID: <0854f35e92c95e552721dc6a46f4ee2bc4020bc1.camel@synopsys.com> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.87] Content-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_050908_758874_F768DD3F X-CRM114-Status: GOOD ( 12.08 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" , "keescook@chromium.org" , "linux-kbuild@vger.kernel.org" Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hello Masahiro-san, Starting from kernel v4.17 it is no longer possible to install kernel headers for ARC architecture if there's no cross-toolchain in PATH. Note installation of headers is just one of use-cases when we might not have cross-tools available but still want to run "make xxx_defconfig". I.e. the problem is "make xxx_defconfig" with no cross-toolchain. That's what I see: ----------------------------->8-------------------------- ./scripts/gcc-version.sh: line 26: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 26: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: arc-linux-gcc: command not found make: arc-linux-gcc: Command not found /bin/sh: arc-linux-gcc: command not found /bin/sh: arc-linux-gcc: command not found *** Default configuration is based on 'nsim_700_defconfig' ./scripts/gcc-version.sh: line 26: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 29: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 26: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: arc-linux-gcc: command not found ./scripts/gcc-version.sh: line 29: arc-linux-gcc: command not found init/Kconfig:17: syntax error init/Kconfig:16: invalid option ./scripts/clang-version.sh: line 15: arc-linux-gcc: command not found ./scripts/gcc-plugin.sh: line 11: arc-linux-gcc: command not found make[1]: *** [scripts/kconfig/Makefile:91: defconfig] Error 1 make: *** [Makefile:531: defconfig] Error 2 ----------------------------->8-------------------------- That doesn't happen for ARM and other arches simply because for ARC we define CROSS_COMPILE if it is not set by user, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arc/Makefile#n9 Still if CROSS_COMPILE is set before execution of "make defconfig" then the same problem happens for others. I was able to find a series of commits which cause this problem, here they are: ----------------------------->8-------------------------- 59f53855babf - gcc-plugins: test plugin support in Kconfig and clean up Makefile 469cb7376c06 - kconfig: add CC_IS_CLANG and CLANG_VERSION a4353898980c - kconfig: add CC_IS_GCC and GCC_VERSION ----------------------------->8-------------------------- What happen is "$(CC)" is passed as an argument and in its turn CC is "$(CROSS_COMPILE)gcc", see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile#n385 So if I substitute "CC" with "HOSTCC" in a couple of places (see below) the problem goes away. But I'm not really sure if what I do is correct. I.e. when we're interested in CC for target and when only host CC is of our interest. Would be interesting to know your opinion here. -Alexey -------------------------------------->8--------------------------------------------- -------------------------------------->8--------------------------------------------- diff --git a/arch/Kconfig b/arch/Kconfig index d1f2ed462ac8..53c8c7994e6b 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -412,7 +412,7 @@ preferred-plugin-hostcc := $(if-success,[ $(gcc-version) -ge 40800 ],$(HOSTCXX), config PLUGIN_HOSTCC string - default "$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" + default "$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(HOSTCC)")" help Host compiler used to build GCC plugins. This can be $(HOSTCXX), $(HOSTCC), or a null string if GCC plugin is unsupported. diff --git a/init/Kconfig b/init/Kconfig index 2a48832fd40e..a0094ddb8244 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -13,7 +13,7 @@ config CC_IS_GCC config GCC_VERSION int - default $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC + default $(shell,$(srctree)/scripts/gcc-version.sh -p $(HOSTCC) | sed 's/^0*//') if CC_IS_GCC default 0 config CC_IS_CLANG @@ -21,7 +21,7 @@ config CC_IS_CLANG config CLANG_VERSION int - default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) + default $(shell,$(srctree)/scripts/clang-version.sh $(HOSTCC)) config CONSTRUCTORS bool diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 86321f06461e..684cd645eeb1 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -109,7 +109,7 @@ as-instr = $(call try-run,\ printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) # __cc-option -# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) +# Usage: MY_CFLAGS += $(call __cc-option,$(HOSTCC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) __cc-option = $(call try-run,\ $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) @@ -143,11 +143,11 @@ cc-disable-warning = $(call try-run,\ cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) # cc-version -cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) +cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(HOSTCC)) # cc-fullversion cc-fullversion = $(shell $(CONFIG_SHELL) \ - $(srctree)/scripts/gcc-version.sh -p $(CC)) + $(srctree)/scripts/gcc-version.sh -p $(HOSTCC)) # cc-ifversion # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index dad5583451af..3b28bf94cb24 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -27,4 +27,4 @@ cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) ld-option = $(success,$(LD) -v $(1)) # gcc version including patch level -gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') +gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(HOSTCC) | sed 's/^0*//')