Received: by 10.213.65.68 with SMTP id h4csp429249imn; Tue, 13 Mar 2018 08:47:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELvsDm9hjNn9HoWE0F2hBwWD4tagkKw1B4WdwyqYfCfDH5sV4RlFBCPjbv/gbf9fP7yLFtXK X-Received: by 2002:a17:902:71c5:: with SMTP id t5-v6mr679181plm.107.1520956039395; Tue, 13 Mar 2018 08:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956039; cv=none; d=google.com; s=arc-20160816; b=R728aq+p6z8IoVbKtPw9fSmBM5zW2xs//vvNX4k59j8vlQRj3y8P7KLZHduLOSpA6H JyVdeit5o6Opv2dBjOzsTCnR69kgmlhWvWqjYZt6Y49OpFkHmuXfYG0cR04yaFeXETCb RVXXrzAzt8hl0LwNZDFo6DjhpRntlh5iPxCimGLSADMrhkHZFYS1Mdi/XIwPEjTYoCjE CWdVlgTjCtue6oxg6EDT4+H+FK0KtIAd7XQHepnJGtfK4QNgcgJEBMQEMKqiSg2jKLPf CryZrTxKhpbpeINnMylFZk1RlFGqmNqo7gWMVX1S7l3AKLW4NSl9LFWDsNaa6cfIAZIm SldA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FgGW5TQup00YUDw7S/BOElYSVJk5Uzf3TAjGTbKmAII=; b=ckIzW77MiiFoaYz+EGPkjciiKhV+2j39HaTfUXl1tG+PlWXrryoVRNIFbWjRp/I7M7 TAx2ytZAudraadjIl2uQvOBCM84ssFv7evJYHvYb7OrnTAeGRTS2FQHgdoqB997EiwQl pxUEOFQlClmixfj48s9vVHi1wUisupvWrJp5fGzvW0PJRo/Uw2e1GyDoMs+010NhaHYc 6vOuPsnYBeQLD4HsbUaZzhOxjflrijyTou71RcknoLCstWtfKvvYDhYa2FiNWJ9v111k VfozdkcxwPjk6VzmTOHycYCs8RkihNhXMfKtcF53YxBVOX1tYIqYO8oPNzLjgcVpaRO+ fsXQ== ARC-Authentication-Results: i=1; mx.google.com; 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 r4si255483pgs.685.2018.03.13.08.47.04; Tue, 13 Mar 2018 08:47:19 -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; 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 S964870AbeCMPoQ (ORCPT + 99 others); Tue, 13 Mar 2018 11:44:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37084 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935011AbeCMPli (ORCPT ); Tue, 13 Mar 2018 11:41:38 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C3528122E; Tue, 13 Mar 2018 15:41:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Masahiro Yamada Subject: [PATCH 4.14 135/140] kbuild: move cc-option and cc-disable-warning after incl. arch Makefile Date: Tue, 13 Mar 2018 16:25:38 +0100 Message-Id: <20180313152507.256463364@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-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 Signed-off-by: Greg Kroah-Hartman --- Makefile | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) --- a/Makefile +++ b/Makefile @@ -492,26 +492,6 @@ CLANG_GCC_TC := --gcc-toolchain=$(GCC_TO endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -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 ifeq ($(config-targets),1) @@ -724,6 +704,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