From patchwork Sat Nov 26 18:02:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Foley X-Patchwork-Id: 9448381 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 EA3B26071B for ; Sat, 26 Nov 2016 18:02:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0EF826BE9 for ; Sat, 26 Nov 2016 18:02:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E57B326C9B; Sat, 26 Nov 2016 18:02:45 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 3BC5226BE9 for ; Sat, 26 Nov 2016 18:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753002AbcKZSCm (ORCPT ); Sat, 26 Nov 2016 13:02:42 -0500 Received: from mail-qt0-f172.google.com ([209.85.216.172]:35234 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752989AbcKZSCl (ORCPT ); Sat, 26 Nov 2016 13:02:41 -0500 Received: by mail-qt0-f172.google.com with SMTP id c47so89686300qtc.2 for ; Sat, 26 Nov 2016 10:02:40 -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=z7H2p5lTUmWP9PvTE2Gas51HXZrNQ8wGlTccI/cgSek=; b=qrBtRQFfdNNbVDY7ugtvEq5tpThGtqDFuYT2m3bo79mulRCPs4XQE03Zc0TiRqPsZU mmZVRhi5LxcNA04/IWmG+EqI6Mk/Qy6d8Wf2ymUk/tT2cdp/gEXQUg2CCXvbNoAbpHqA y4Px47CX9AhuSBOs+pHtS4l18XaKbxXA1jmE0= 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=z7H2p5lTUmWP9PvTE2Gas51HXZrNQ8wGlTccI/cgSek=; b=ifrhQP2Nr1/Ey5x8kgQ9M5PzzybxNP5HWrA0EiY9GXB6WMjzdOxCALGL+gQBNvBWY7 FKJhJa66G0n8NUyFct560pS6h+B/WxqgDF4JDgyK7ukohO05Bw/HP4gD7ShbOWA3yUeO mwuvZ4tvFuKdJe6eK/sFEALVthlCW6Bh6/pNq0c5tXO4/b08KZGfqT84C3mEMJ04IuZ/ hKo9YuxNqLiE77GciKOgEp7zJ3PMNg3yJbToD6WUn74vDA9yy9mrcNQhCrC2kWWadavt LBbVnO+Ji8UTeO8tJDl0BIESgVH/W0Pau26DxVbYjtUtDkiDlmiYewsD14/XYAOvUvi0 wKRg== X-Gm-Message-State: AKaTC03xPRRAV8CLVf+2w5WgvVRp/Of3yhkpyviFQM4+sDN044a3pf8esA8OXGnEElgf5Q== X-Received: by 10.200.46.40 with SMTP id r37mr11807804qta.267.1480183359963; Sat, 26 Nov 2016 10:02:39 -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 l135sm24326587qke.13.2016.11.26.10.02.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Nov 2016 10:02:39 -0800 (PST) From: Peter Foley To: linux-kernel@vger.kernel.org, mmarek@suse.com, linux-kbuild@vger.kernel.org Cc: Peter Foley Subject: [PATCH v2] Fixes for compiling with clang Date: Sat, 26 Nov 2016 13:02:24 -0500 Message-Id: <20161126180224.29783-1-pefoley2@pefoley.com> X-Mailer: git-send-email 2.11.0.rc2 In-Reply-To: <20161126042724.15461-1-pefoley2@pefoley.com> References: <20161126042724.15461-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 Move definition of HOSTCC to allow use of cc-name. Suppress warnings about unsupported optimization options. 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) Signed-off-by: Peter Foley --- Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0ede48ba5aaf..b69ad7e4a6d2 100644 --- a/Makefile +++ b/Makefile @@ -299,16 +299,6 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) -HOSTCC = gcc -HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -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 -endif - # Decide whether to build built-in, modular, or both. # Normally, just do built-in. @@ -343,6 +333,16 @@ export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD scripts/Kbuild.include: ; include scripts/Kbuild.include +HOSTCC = gcc +HOSTCXX = g++ +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 \ + -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers +HOSTCXXFLAGS = -O2 + +ifneq ($(cc-name),clang) +HOSTCFLAGS += -fno-delete-null-pointer-checks +endif + # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld @@ -685,6 +685,7 @@ 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, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) @@ -695,6 +696,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.