From patchwork Mon Aug 5 13:02:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 170536 Delivered-To: patch@linaro.org Received: by 2002:ac9:2daa:0:0:0:0:0 with SMTP id g42csp4143435oce; Mon, 5 Aug 2019 06:13:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfoFer3LtvMM1rdk4ur2RIDOJ6jwJJFX60T6JU5bwRrdnGW8rEtZkPWjRx3c8Q5toIasI9 X-Received: by 2002:aa7:9359:: with SMTP id 25mr71038321pfn.261.1565010746868; Mon, 05 Aug 2019 06:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565010746; cv=none; d=google.com; s=arc-20160816; b=y2AsnzDO1Z0Ka7k1qQpS+WXCu2nV7x9MyVJ5QXTBPmdn4AEZd+zWJwy7kPIymjplia AtX27LiDX7xkAu/DrlAZCzfIqiMC8WFN6xLend2vtuxP3RfUDb4ey1ngdOwwPg9l2p9r kTg1tf++mHOH6ujRYrgVO4IDKL9YeI/FvX3BnjmLOlVuHA9FBm0bCngJaIvfeEhgqiSd nkrwKrnprE37XDrtT1sJydTiNBsWAypq3rbnDhX27jbrEZfg3ZfcaSqEyvLZPAGGkkhA uMj9DGVmIcUW8Psmg1Kr8oY8mnrPloVtNSIOP2iEa3soSdFZL1jKGZEiFEKu690V7FhW NbOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+sqNg8u3TZiEb055JupoZ1m+RC1lMXFXJqKbWDomMlg=; b=yJGtWN6Mke2hHOFfgwaef3xVfBf5YACZHu8GwOizi386IQzRd8iNI6/VEdfgRtouIN DTesMXx00VZ06WDXdKQ5iUQOabi8IdrLKlciyjb2WuLH8weqZ+piaNbWejiRvHA/tAfj AotFcc+JDNducQdtEVuu0yz1wB7SbcGHBWmV34ohemr4tObmyyEnDesVUH9zwVj3Qj66 9N51MBclm1p2Mf5bfSDeiLjv71yf68c9YGs7NG7BzRqC8EiokFbuy3x7F3oAzymYmRle aPDqJ5Peh8CbYG36hoclOoKfSIr9guBUmtI4hPIUE1S0WW+iW9MQRG3WmfZNoMUYwIdb xJrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K9thxZOv; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 b15si37421839pgj.141.2019.08.05.06.12.26; Mon, 05 Aug 2019 06:12:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@kernel.org header.s=default header.b=K9thxZOv; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729137AbfHENMU (ORCPT + 14 others); Mon, 5 Aug 2019 09:12:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729415AbfHENKa (ORCPT ); Mon, 5 Aug 2019 09:10:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F23020880; Mon, 5 Aug 2019 13:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010629; bh=Xk2akffglzIX5CNolDYB5446ub7rD9dozs1DN9GnEnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9thxZOvHNqOcR+II/ir5NdUIi1MJebunjHW4eFvZQGEL5RhAXmk/fPsSgq5nESiQ vS4yw8nu2cwYwYbMwNz+iUwgOcrsv8hFGvkgpT5Pg0R/RL7Ousgnr2fMmb7f0UDNtB mhMKevo0g4OWebCPiMo9V0JBMNWekH65+Bl3hc3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers Subject: [PATCH 4.19 43/74] kbuild: initialize CLANG_FLAGS correctly in the top Makefile Date: Mon, 5 Aug 2019 15:02:56 +0200 Message-Id: <20190805124939.358044329@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124935.819068648@linuxfoundation.org> References: <20190805124935.819068648@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada commit 5241ab4cf42d3a93b933b55d3d53f43049081fa1 upstream. CLANG_FLAGS is initialized by the following line: CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) ..., which is run only when CROSS_COMPILE is set. Some build targets (bindeb-pkg etc.) recurse to the top Makefile. When you build the kernel with Clang but without CROSS_COMPILE, the same compiler flags such as -no-integrated-as are accumulated into CLANG_FLAGS. If you run 'make CC=clang' and then 'make CC=clang bindeb-pkg', Kbuild will recompile everything needlessly due to the build command change. Fix this by correctly initializing CLANG_FLAGS. Fixes: 238bcbc4e07f ("kbuild: consolidate Clang compiler flags") Cc: # v5.0+ Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Acked-by: Nick Desaulniers Signed-off-by: Greg Kroah-Hartman --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/Makefile +++ b/Makefile @@ -430,6 +430,7 @@ KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds KBUILD_LDFLAGS := GCC_PLUGINS_CFLAGS := +CLANG_FLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS @@ -482,7 +483,7 @@ endif ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) -CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) +CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)