From patchwork Sat Nov 26 18:20:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Foley X-Patchwork-Id: 9448487 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 140686071C for ; Sat, 26 Nov 2016 18:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED51926C9B for ; Sat, 26 Nov 2016 18:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCAA326E5D; Sat, 26 Nov 2016 18:20:23 +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 47B7826C9B for ; Sat, 26 Nov 2016 18:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbcKZSUL (ORCPT ); Sat, 26 Nov 2016 13:20:11 -0500 Received: from mail-qt0-f176.google.com ([209.85.216.176]:33485 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbcKZSUK (ORCPT ); Sat, 26 Nov 2016 13:20:10 -0500 Received: by mail-qt0-f176.google.com with SMTP id p16so89652981qta.0 for ; Sat, 26 Nov 2016 10:20:10 -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=W9HbBDw5iXipxnCsoEh30Re+PyBFzMi/Wp81amVeYmI=; b=jmiP7YLV1mYNa77284svTGXLmvzDTKxsRFlvm1xi33046WQ2xpkiY+kix3hW3/jvED BG46It8j763d9puuSj2XPCtSkSvb9tD+ojkauhOz4xqul9tZwWmmlGAtrE99SmnpiVWG i7MoPeegtquqBPjnmT77MDMAMI8jQel6/bZ7U= 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=W9HbBDw5iXipxnCsoEh30Re+PyBFzMi/Wp81amVeYmI=; b=e6YQIJJAqVN3rrsJwt/BnnKeYeOKWsFDGyaxGaXhm6qWTtGK9wZFIdbnw4fk+hF1Ey 0og9i7wBR6ZvcJcZxj18wzrtFQzShVPgcyou0rJTPH23IWoqprCrXY9Qq/KCoAZPClGp PoZpXTJxJQpzYleQI/n0mt5kZwSo3ZEuBoUnoT6QvkdvLxEYqmjrtE4TGHNmyiw9orsY UETkg5NCnSqmaA0VvpVkWFRqL9TNBuHOXtbe/btS16+7P/ocJzoRGTJCvWOj7a/9pO9B kQertjKM243Ap9hlHWsIETnS4CFfHG1DYQO1Gy1Lu/Hj0z6lbzTGUzRzJGA0nkrsgmKA /wZQ== X-Gm-Message-State: AKaTC00vnj8EdqLmm6rolJhYtJjL26/FS4S5A31vXIu4hmzleP/cCi1vSG+XY3YUqBmGCw== X-Received: by 10.237.60.101 with SMTP id u34mr13489396qte.53.1480184409559; Sat, 26 Nov 2016 10:20:09 -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 6sm24390875qke.18.2016.11.26.10.20.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Nov 2016 10:20:09 -0800 (PST) From: Peter Foley To: linux-kernel@vger.kernel.org, mmarek@suse.com, linux-kbuild@vger.kernel.org Cc: Peter Foley Subject: [PATCH v3] Fixes for compiling with clang Date: Sat, 26 Nov 2016 13:20:06 -0500 Message-Id: <20161126182006.24815-1-pefoley2@pefoley.com> X-Mailer: git-send-email 2.11.0.rc2 In-Reply-To: <20161126180224.29783-1-pefoley2@pefoley.com> References: <20161126180224.29783-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) Changes from v2: * Actually commit the changes in v2. Signed-off-by: Peter Foley --- Makefile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0ede48ba5aaf..94402cef6622 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. @@ -373,6 +363,15 @@ LDFLAGS_vmlinux = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) +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 # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE := \ @@ -685,6 +684,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 +695,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.