Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4901238imc; Mon, 25 Feb 2019 13:16:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IY2wgFwjxv0AIXhtx02WGVIrGsXhaelEIPsTiQli/XQhwhOmbr9BNTBRHsGhVXkOoprrm7Q X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr21553534plh.302.1551129385483; Mon, 25 Feb 2019 13:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551129385; cv=none; d=google.com; s=arc-20160816; b=mXoj4TT/NLjwJlmtMvUCugxkYXlkxwQcOQX3EItITp/s4I9gA7O9SULS0g/zChCxF9 5v4boGo6iEHFgtQvWiyJ3BUrKzc3rBfnSFOs4A2kXXnNYnWW2UmqpZhf2AvKIMDgSBC8 ZHKeaBiDQLTNZNpRao3WJhjPm173JAMsGfMDfWIlOoNePUu32gfaVVGZ4g4dgc7NU0TS ODTzIX1hSuiX0g+sxJn5j99JPhYYTFe6tMOldqxCUIQAHSiQGXJjdOwMy4E7H3HpiDb9 9qw6SRQQJdN7CNYdSEcvhaxPAp3PEQZHlNTcPfttke/yA+7H3snHcfxfWkLqa9+W4JU5 6Haw== 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=oBlILc3r8QCV/ZCeYXN7s8yI7cOM4kJ7RAkuHQy5IEQ=; b=HsnKrgJSaEJxlsSVD7KdGnekuKe5WFTC17EL53hNnoywJTC0qS45/8izRVw7nYTckC +MqJLPOPwUFOSO/VB4pUtqh+z2udaEA0c9U/aeqqDcDOIvFHP/hiEHqruomcgcRjlUCd 0mmAweQ3dEwYawjRXYcDIXfTdLZ/QoUmmYeZto3M6G9WprPsOzkxwb9yo+P/9bF9ZB3c B8mS9+tGWFfmw/SWhFWpbUp35jGe581UGrkusnNYw0ZeZwZMNUihWIalnDgY7O9a6gl/ AEJOij5udpSuSb6c6l4Sp+Fzfxg9Ca0DAM+7hgwDu6ZU4kgPB2W9oIQ0GtxgC2O72m6P EdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ld1BLKtt; 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 u14si8829220pgh.561.2019.02.25.13.16.10; Mon, 25 Feb 2019 13:16:25 -0800 (PST) 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=@kernel.org header.s=default header.b=ld1BLKtt; 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 S1729410AbfBYVPG (ORCPT + 99 others); Mon, 25 Feb 2019 16:15:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:46082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729345AbfBYVPE (ORCPT ); Mon, 25 Feb 2019 16:15:04 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 E71BF2147C; Mon, 25 Feb 2019 21:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551129302; bh=p3gERCHia86PuY6qMWCYr1lJ+59SaM9xxahcyPJcVuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ld1BLKttahtQe+lR1vrALbwnQjkJ+ruJgfk/cLimh5L+BPRHkSshlQNE2OSUF1KHI 5izNHO1yOQ/uJLtPUUCVimhMoy2PNpg7X0vTXqnBZqEGMPPunz6N5sMOxV/JMWlgge +8Wt9D7ObIShYtUjUy5fh7tsUjsT2ux4h6ffrCH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Masahiro Yamada , Nathan Chancellor Subject: [PATCH 4.9 49/63] kbuild: move cc-option and cc-disable-warning after incl. arch Makefile Date: Mon, 25 Feb 2019 22:11:49 +0100 Message-Id: <20190225195039.584958258@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225195035.713274200@linuxfoundation.org> References: <20190225195035.713274200@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masahiro Yamada commit cfe17c9bbe6a673fdafdab179c32b355ed447f66 upstream. Geert reported commit ae6b289a3789 ("kbuild: Set KBUILD_CFLAGS before incl. arch Makefile") broke cross-compilation using a cross-compiler that supports less compiler options than the host compiler. For example, cc1: error: unrecognized command line option "-Wno-unused-but-set-variable" This problem happens on architectures that setup CROSS_COMPILE in their arch/*/Makefile. Move the cc-option and cc-disable-warning back to the original position, but keep the Clang target options untouched. Fixes: ae6b289a3789 ("kbuild: Set KBUILD_CFLAGS before incl. arch Makefile") Reported-by: Geert Uytterhoeven Signed-off-by: Masahiro Yamada Tested-by: Geert Uytterhoeven [nc: Backport to 4.9; adjust context due to a previous backport] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) --- a/Makefile +++ b/Makefile @@ -521,26 +521,6 @@ CLANG_GCC_TC := -gcc-toolchain $(GCC_TOO endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) -KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) -# Quiet clang warning: comparison of unsigned expression < 0 is always false -KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) -# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the -# source of a reference will be _MergedGlobals and not on of the whitelisted names. -# See modpost pattern 2 -KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) -KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) -KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) -else - -# These warnings generated too much noise in a regular build. -# Use make W=1 to enable them (see scripts/Makefile.build) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif @@ -739,6 +719,29 @@ ifdef CONFIG_CC_STACKPROTECTOR endif KBUILD_CFLAGS += $(stackp-flag) +ifeq ($(cc-name),clang) +KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) +KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) +# Quiet clang warning: comparison of unsigned expression < 0 is always false +KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the +# source of a reference will be _MergedGlobals and not on of the whitelisted names. +# See modpost pattern 2 +KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) +KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) +KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) +else + +# These warnings generated too much noise in a regular build. +# Use make W=1 to enable them (see scripts/Makefile.extrawarn) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) +endif + ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else