From patchwork Mon Nov 27 12:15:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119695 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp174416qgn; Mon, 27 Nov 2017 04:15:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMY6koBdLzcS6O/88vbCsf+Qdzewayv+/nUq78pRY/L32wROcn3rIOhjMWZTBGLh7VIIglBn X-Received: by 10.101.73.139 with SMTP id r11mr37105547pgs.411.1511784955511; Mon, 27 Nov 2017 04:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511784955; cv=none; d=google.com; s=arc-20160816; b=t/ejqk+ImdkqpkxSRiTpvY28aM1LMNAHE+m19xf4SZTwUHRYwVmoPuHxf585pn4XGK uw1HCqiSX814chVMCeCNsSK8VK1A2zkjUEhcea524bVMKNiTRzsOp0w6/etQQjujH6Dy r8JRo6X5xPL0UDKk+wH4bFHX6z/pj6Vwv2ACHKpMG+0QyjdrdyTp6HPXP6cn+cqDEc6z dIkGh2ZWtbugQ34FfnzLhNOESfKC+KPTB4syhB889/0+P6oQ0R/DC3IcXfLEWH6jKG3I D3z1qozJ/iypUpRkFLgaFESBiQotvQG/cp5EPsiN2J2isZUv6rcUBfK3Wx6BtoR2pWBp e13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=grbua2YGP6csJn1/UUztqD44X7fMmZQ6M+ZHSXdhJQE=; b=tNOuKwDeLnLYUCNpZ7m2Ws3UObJws+7R4szUFwxq6r6TaDs+wk5eOBskvGhe6FP5gt HYg7p+diBYwr4+0+aqClejMGu7DagJqjsxnT8TsxCmwW9SSoqm2aPH263X00jeARNmpJ 5YzZ29gq4Rtjt09dWvr9H6Y48dSPd/ItyLaStaqSgmZxpfA+fkLtcnegxKPtn+1t0+oO KyqDCHskgdYsPYX0NbFOlQzt6eJ+Q3Iiz/JeX3tTaD3b6ucXe4Ieu22r/9yCS3MHjWjo XeRiFP5c9S7xCMYVVETj3To8wxmyThS/yXkVTzkx0SMrIlGcN3AiN/aMGCxjGRvrXwNw nSkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Plz+LkLE; 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 91si23066784ply.236.2017.11.27.04.15.55; Mon, 27 Nov 2017 04:15:55 -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=@nifty.com header.s=dec2015msa header.b=Plz+LkLE; 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 S1752125AbdK0MPw (ORCPT + 28 others); Mon, 27 Nov 2017 07:15:52 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:55727 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbdK0MPv (ORCPT ); Mon, 27 Nov 2017 07:15:51 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vARCFOfm006751; Mon, 27 Nov 2017 21:15:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vARCFOfm006751 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511784925; bh=grbua2YGP6csJn1/UUztqD44X7fMmZQ6M+ZHSXdhJQE=; h=From:To:Cc:Subject:Date:From; b=Plz+LkLE1zTb2fPN5QsZ8d4vFbUniSF35qv57sxh3oPIXlsrKhA1mnPaXB0Kb/WOz kZnCJYEOglJTP4uc8Hbi2uUDBnArzOd39vwYfp0pJkUHwN8oYtLGW1ECqyW3LkaTNE 5avqMdb78uinHX2FS5ZjisBos2bviQjt8Va0rhVqYQ7DkJTaxPAeMKv8kAk7zXH/Se 9mU6kYgHxc1KfaCaoYnza1KMpDGsHJ0lxwHpId1cZOyLBsvyXnxdupo9dziGmI36RX zIfVMw1QEpV8RWo994Ez/+vTnQPO1DtY/rhnhCy6fmTtNsloQCVqcL+mTXhrGlqBNQ tyWfFjGpeUSXw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Geert Uytterhoeven , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: move cc-option and cc-disable-warning after incl. arch Makefile Date: Mon, 27 Nov 2017 21:15:13 +0900 Message-Id: <1511784913-3396-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: ae6b289a3789 ("kbuild: Set KBUILD_CFLAGS before incl. arch Makefile") Reported-by: Geert Uytterhoeven Signed-off-by: Masahiro Yamada --- Makefile | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) -- 2.7.4 Tested-by: Geert Uytterhoeven diff --git a/Makefile b/Makefile index aa67428..ac2d4e1 100644 --- a/Makefile +++ b/Makefile @@ -484,26 +484,6 @@ CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) 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) @@ -715,6 +695,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