From patchwork Mon Aug 5 13:02:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 170537 Delivered-To: patch@linaro.org Received: by 2002:ac9:2daa:0:0:0:0:0 with SMTP id g42csp4147743oce; Mon, 5 Aug 2019 06:17:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzt6PWGRR1T37Uz2TWFLNRUbRCanuMVKeg7fVSzVkLcqrzqd/bs12X2N1hzQmc/3HgCTJah X-Received: by 2002:a63:2784:: with SMTP id n126mr30141328pgn.92.1565011036053; Mon, 05 Aug 2019 06:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565011036; cv=none; d=google.com; s=arc-20160816; b=002MLnFbFedKqv44ZTGV6ctU244BkmwtZFUAXba4dwdbJiEcaUWn7N4gLDjBZVYNbS 9UOmziIVHtZKqSG2faINPG6X+0XP5SWczS++pyrmnY28qwMRqSLcn94cXO2sXERtAh0Y rRHLCbHqqmc9G59M2DCgNhJHRXH65ImdWfC32XOMVi/NwO9hK4XP0m88EthXpmqDW1eV M18E4LLIdNgWu91dQtB0TKKA//yMZCi9SaEJQJdlJWxMXMZTdeOX0aVG0l4lgYDcUY/8 sSlnn15yyrhu9jOmv0m+0Cw13Z+Dm/3ato+RiLI4ZviNshrOr2DMQe9o8JgKu3EmMsqE 5cgw== 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=5mBWuU/cZPLOnxSdTsw6xzIeqi/RTnHMuDQNZIuwgn0=; b=b0MdCcrVJ8rjhlqIl7OBp1lcd2eqUG4Ysc3qECgdJ92mFjDfRvp6aPY+APnyvXXWB8 kFgLqRpD1kqFkSHpS+xj0Bub/1/M+lFfMk6gQQ7bqQbtGRiZmHhiRr3udPDN4pwmuZuy chBETOZY5XnqCnr1qCQpG+0IPTXPFYdw2HrNdI1dfcNsdTR5kwoI1yHQ2fePuXcXrmcz 9fgi4RLKknWRfJYvpTXaCeye8i5rs03MQmpzTAiATzn68UFCqbNSnGuWNa4LAjXEFB+6 PQg9bcnbVfBGyqDsfuUzqogor/p/+GShUqMQfJEhVGKpYw9/xgjbJc599JXdLlP8vLq4 D92w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oUYXmpNW; 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 q11si7099774pls.424.2019.08.05.06.17.15; Mon, 05 Aug 2019 06:17:16 -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=oUYXmpNW; 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 S1729027AbfHENRO (ORCPT + 14 others); Mon, 5 Aug 2019 09:17:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:41654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbfHENFd (ORCPT ); Mon, 5 Aug 2019 09:05:33 -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 A409021734; Mon, 5 Aug 2019 13:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010333; bh=55kzN6cH4e2VjwxG5P8WucW3r+7cEWtq7OITjexsbm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUYXmpNWjIEPm+9f73wRu1r4JrB1FkqKK6iO78Kiiwj9mAPtEQ9unArljDn5JgBCa ui8w3qtBlE4YuYPGqmkafydod68EdPxJKsNE/Rj/wE0IeaFAYelkNMOcfP7bfe0Yom iW4IuM3uCEe9ZKm4Wx+GyVvPZX2mofQ8y8hrqcII= 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.9 26/42] kbuild: initialize CLANG_FLAGS correctly in the top Makefile Date: Mon, 5 Aug 2019 15:02:52 +0200 Message-Id: <20190805124928.061617180@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124924.788666484@linuxfoundation.org> References: <20190805124924.788666484@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 @@ -400,6 +400,7 @@ KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds GCC_PLUGINS_CFLAGS := +CLANG_FLAGS := # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) @@ -506,7 +507,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)/..)