Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5645128imu; Mon, 26 Nov 2018 03:27:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/WjRpGcxTZR2c6to8kbC4Gi743iKtLINHEkGv2hk5Cwg1GhWTITBRj7gMtcqW8V3UkV4XTy X-Received: by 2002:a65:58ca:: with SMTP id e10mr22490588pgu.99.1543231663713; Mon, 26 Nov 2018 03:27:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543231663; cv=none; d=google.com; s=arc-20160816; b=cPSb9W13EXyOgh8QgKS/kivccTIL0m7g+wvAamPtI8RGPgIR6BTZ+B4jb2ZRVKLqUo jeQi9pXv9r79A9skvY6wwwvyiKcxtWrDaFMSX3JnzucRPmeXFV4NjSSpAJ4Sa4xmoCV4 GT07kpHlcdmAB/UVGYX0h9dI3ShKZEDOt1dDpUFkYZWEQsopZgQUe7Vf6aI/O5T+eK+2 NnnkbhTO5DMT3/FlA2/zPTxYqeBajcIAlDLryB1ICGY2RShE0KqJr94OQEx3LIpzew9n pYj4XsINft0WJbNW7zwqzLtriBRCGOQCB7/ZqsPmgNF43lv/MfZh4FjBUYfA+mJr+BjW ogNQ== 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=jGTOXrq8JTbb0fqCQ9gJe8MpUrLd8SamqVi0tazVU+w=; b=F5JJBnEsA0M7Ga9TQHhkXCgHEBz9qVN1ejDYlfCczZZwV2nlcCjJ20fWS5scKrUz/C Q3eLQuB1m0FpdDkJ4Z3g3qrybJiHNb/VOckKyxMzTaEtkhqXMF/bBzOwvMZ+VcGWG/KE mSOWp03he72XCv5xa4+bUewyUTLVL/NQX76B3l07/fH/gcEfS32Jk7OzAlZDI4ls/CLX 82/nXI7QNHWNg/IYEpqH35+wFeO9AgSxAh6Lh7MUoMIFduhTQu7YwoTatTy56O1H5Gs0 /GL4ii2sW6V+slEDJrnjIGspyWy0NVJJguPjUdIA2rYsNut9QMUke4MAkBR9H4sSc8s6 8L8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=raPapOO3; 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 z6si11746pln.66.2018.11.26.03.27.20; Mon, 26 Nov 2018 03:27:43 -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=raPapOO3; 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 S1727331AbeKZVsB (ORCPT + 99 others); Mon, 26 Nov 2018 16:48:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:56346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbeKZVsA (ORCPT ); Mon, 26 Nov 2018 16:48:00 -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 99B9420817; Mon, 26 Nov 2018 10:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229656; bh=qQtA+BepNikHxNTVO0d7tLGQcRTADjdtPSf5sCsm3EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=raPapOO3YV+rEOXu5oKsQIBSAxlh1f79vXq3vpgSf9vVD1EgHyTKraCI1ysjIQq9Q xJt/nJH3FjGa8MNc2nAOqEhpRRlodUzVBztdkjmfCiu3bgRLYAPP2Qk+oUFE/Niir8 +crFFuX3QnMjtUjr0PzEc4QuT988VNLWBDLlisqI= 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.4 22/70] kbuild: move cc-option and cc-disable-warning after incl. arch Makefile Date: Mon, 26 Nov 2018 11:50:37 +0100 Message-Id: <20181126105048.949939618@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.4-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: Adjust context] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) --- a/Makefile +++ b/Makefile @@ -622,26 +622,6 @@ CLANG_GCC_TC := -gcc-toolchain $(GCC_TOO 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.build) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default @@ -729,6 +709,29 @@ endif 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