From patchwork Mon Nov 28 06:44:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Foley X-Patchwork-Id: 9449123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32571600CB for ; Mon, 28 Nov 2016 06:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204242022C for ; Mon, 28 Nov 2016 06:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 125C0204C1; Mon, 28 Nov 2016 06:45:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD1C2022C for ; Mon, 28 Nov 2016 06:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754400AbcK1GpC (ORCPT ); Mon, 28 Nov 2016 01:45:02 -0500 Received: from mail-qk0-f175.google.com ([209.85.220.175]:34738 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754393AbcK1GpC (ORCPT ); Mon, 28 Nov 2016 01:45:02 -0500 Received: by mail-qk0-f175.google.com with SMTP id q130so130534678qke.1 for ; Sun, 27 Nov 2016 22:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pefoley.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oUzhKiVJeNX4v7j+cOrk4aM+2/PcdiTjeAOHQcArpMk=; b=iM6m1Y1tQML5oQtk3gvVYh31xyyJVpGJz+z4mMdZFiIRqQP5sjHnlCdPgOV9pVctDT jQnf9fPyWNepq1Kl1jQEX3no3kHrtS/fHvPvoJvG2BH5c06Tkqms9BRETq1sJmevuwJ/ Rs1HsPQrKDoc2hwSF0XhgYFs5Wtq9CH9gkpCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oUzhKiVJeNX4v7j+cOrk4aM+2/PcdiTjeAOHQcArpMk=; b=BlMEgom3VM638VIAwYmMVoo5wXViTvLonqim3OOMBJb8mCdQcoU9xJvCPWMFiRQTyI CQkL92qcmdhKoFTmr+JYIziZFzAowqYz97cARhbfQ80pipIbcm9R5EZ84Sbmt4/0fSyb NHFF3uUl2DUJfFIIGHdC9wDY2dwDW2fUBYeYIHTRQkF2aTNrmIG862TTO5GClqkrXehi ofKk4r+sGplgo4nCpJ5SAb21c7iekCCb00x0o9g2iVghIWMUiGdONWfQcTNQPBIV+5VW T2hcGPGGKBaez7EGObAIppYR9TPerXoZK9Ruf8jC6dfv3SZGQUNHjvMVFKyuGPkrkCbP Y97Q== X-Gm-Message-State: AKaTC01tVXAs1fNUG1a3K6m4EaNc8bVjC85aaNINAi15EQO2P489c/G1AupvC3f54txUZA== X-Received: by 10.55.24.168 with SMTP id 40mr17193244qky.258.1480315500854; Sun, 27 Nov 2016 22:45:00 -0800 (PST) Received: from bronx.local.pefoley.com (foleype-1-pt.tunnel.tserv13.ash1.ipv6.he.net. [2001:470:7:ee7::2]) by smtp.gmail.com with ESMTPSA id a47sm27665429qtc.17.2016.11.27.22.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2016 22:45:00 -0800 (PST) From: Peter Foley To: linux-kernel@vger.kernel.org, mmarek@suse.com, linux-kbuild@vger.kernel.org Cc: Peter Foley Subject: [PATCH v4] Fixes for compiling with clang Date: Mon, 28 Nov 2016 01:44:46 -0500 Message-Id: <20161128064446.4892-1-pefoley2@pefoley.com> X-Mailer: git-send-email 2.11.0.rc2 In-Reply-To: <20161126182006.24815-1-pefoley2@pefoley.com> References: <20161126182006.24815-1-pefoley2@pefoley.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix reversed conditional checking if HOSTCC is clang. Suppress warnings about unsupported optimization options. Suppress warnings about unused functions, as they are generated for every module and are therefore far too spammy. Disable clang's integrated assembler which is incompatible with kernel asm constructs. Changes from v1: * Move the $(cc-name) conditional below the definition of $(CC) Changes from v2: * Actually commit the changes in v2. Changes from v3: * HOSTCC is not guaranteed to be the same as CC, adjust accordingly. Signed-off-by: Peter Foley --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 694111b43cf8..9c4803a74117 100644 --- a/Makefile +++ b/Makefile @@ -301,12 +301,12 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 \ + -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers HOSTCXXFLAGS = -O2 -ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) -HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \ - -Wno-missing-field-initializers -fno-delete-null-pointer-checks +ifneq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) +HOSTCFLAGS += -fno-delete-null-pointer-checks endif # Decide whether to build built-in, modular, or both. @@ -685,7 +685,9 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) +KBUILD_CFLAGS += $(call cc-disable-warning, ignored-optimization-argument) KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-function) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) # Quiet clang warning: comparison of unsigned expression < 0 is always false @@ -695,6 +697,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # 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, -fno-integrated-as) +KBUILD_AFLAGS += $(call cc-option, -fno-integrated-as) else # These warnings generated too much noise in a regular build.