From patchwork Sat Nov 26 04:27: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: 9448237 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 263EE60778 for ; Sat, 26 Nov 2016 04:34:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0417627AB2 for ; Sat, 26 Nov 2016 04:34:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA98427D5E; Sat, 26 Nov 2016 04:34:38 +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 96A1427AB2 for ; Sat, 26 Nov 2016 04:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750703AbcKZEeg (ORCPT ); Fri, 25 Nov 2016 23:34:36 -0500 Received: from mail-qk0-f173.google.com ([209.85.220.173]:33861 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750698AbcKZEeg (ORCPT ); Fri, 25 Nov 2016 23:34:36 -0500 Received: by mail-qk0-f173.google.com with SMTP id q130so94543843qke.1 for ; Fri, 25 Nov 2016 20:34:35 -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; bh=W5eVwFQvhFcmawnx6KDbpiLM2FGJ2qj2B2k8KWqgSaM=; b=LD/FBfW2jFSpLwX8upXp7QEb5QN0Y6WYtSxVbELh768BceAgVQAxbYcinaSGYEYuMX kj7RniPagHwliy7RX1kUh/ktS1RT1JzegiiIp/Fc+J5GI6Y+HSBf9pWSouXp3AtKatgy 6yrgwB6Sv/0c59MZGe1+sS+NcrEHNcq/NFMGM= 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; bh=W5eVwFQvhFcmawnx6KDbpiLM2FGJ2qj2B2k8KWqgSaM=; b=WRaszCkwHm6dEl5NNh7tQ19kb1Fi1sgyFh367zWqNCCItuybqxPOW70Nu8MyxtzSi4 UqmVHSAvkxFadhENA2QzF0YDfnksVmd8RC8UxZ7owdJJgQL5RbW19Z8sTKCDuR/Tfyme Vh58CW53nInSukpF98CtbGW2tmMjFQIyp0NP1Mf7eFVz/MKtjIokDk19X2eX/iOJcWhL LGu+H/iflPXVccGJ5fNVJ3iu/sLwRpB08NKGiUQErue6Q5AO3UbinGKSw+YFUmQ+ug8F 2UoMlwpKaLdbi62noQIGEL9ZX2VFhrSdRqZ0Qfr8pErIquiRDQPO2nzBlucS5AzLcFtm 3ZSA== X-Gm-Message-State: AKaTC03+VZsvvnvzzMjeJVZZgXknhubJtA199MbaKAaX4N3/ICMdTqbry48v0ccfbOHoVQ== X-Received: by 10.55.91.1 with SMTP id p1mr10618369qkb.275.1480134457475; Fri, 25 Nov 2016 20:27:37 -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 f66sm23097743qkj.23.2016.11.25.20.27.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Nov 2016 20:27:37 -0800 (PST) From: Peter Foley To: linux-kernel@vger.kernel.org, mmarek@suse.com, linux-kbuild@vger.kernel.org Cc: Peter Foley Subject: [PATCH] Fixes for compiling with clang Date: Fri, 25 Nov 2016 23:27:24 -0500 Message-Id: <20161126042724.15461-1-pefoley2@pefoley.com> X-Mailer: git-send-email 2.11.0.rc2 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. 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.