Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1297375ybg; Fri, 18 Oct 2019 15:25:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqsDWl1WISzBN5DZ25rC6t/u3HhOWvuMOVOwUoRLua6dRTl8hSaN5GYh4ftYYeanR9nLrt X-Received: by 2002:a05:6402:134e:: with SMTP id y14mr12668843edw.55.1571437523646; Fri, 18 Oct 2019 15:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571437523; cv=none; d=google.com; s=arc-20160816; b=OEhzIgQCD/cjeE99uZ5xCui74QrIkQ7BUM50VCTGRclkGOjoIKViqCAYM9+tW005MK g2XrdgD9d1rLKZMlIR0QF4BFQtWNgbde3C+1R5KPTT2S1QY0uglCbzcxi0WEE2uRvgf6 IsifDcBZqjX1CY2NJL9DoU+KpcnkzuSoKJ+vLC2MrC56xhdCqslxhrWz6lVXSNxmf5nk 1fMn/Yc7XVrR+runwq7gxQTxIyFe8DQp70sDE7M9KXPcGcudLvi8jHQ8rt4RnUjG6NJy UVRQ6TSdc4LviTnu7chAdgTwqC8pjbgBCxpiIT6QGpT5mmgpThTYCti2GOD12kTgSY0t rkcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4tqK11FCKTtpeNb/kdkdcZSh26BkLSHk7+0eLJudgpA=; b=bkvrgHSbyP66YFKwwSznUuDFzt7vIsHgSksfZe80nMAyUVXLaDy4W5ke5zY+Qwoucb VcRMwIoZHeyGGjFTt1nCWr9qoTM0P+74hUeQ+xUbMrTXjQXLZfvdBWpfZYVR7QmLFdKL g5MSN+qkPrxwAcmIFbaDIJA2ej4favnbXWh/SdF+vtozQy2iucgpmCZOMru/+jvapsuq y9LeLH5wwA6E3oWbGasmlZG/V4Z9rUWUUvXUVFJAdguDvIUIglbZvoxVK4lr0MpMiw3M O/iuy8cAsL0Mmn881JEfGvqKQXuow0ddTjZvvCqnmkU5htdXg6bnkURo5Utlx9Sk5mZC BpCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ZvTWtpJ+; 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 u18si4332051ejk.105.2019.10.18.15.25.00; Fri, 18 Oct 2019 15:25:23 -0700 (PDT) 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=@sifive.com header.s=google header.b=ZvTWtpJ+; 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 S2408960AbfJRAuB (ORCPT + 99 others); Thu, 17 Oct 2019 20:50:01 -0400 Received: from mail-il1-f196.google.com ([209.85.166.196]:46721 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407341AbfJRAtz (ORCPT ); Thu, 17 Oct 2019 20:49:55 -0400 Received: by mail-il1-f196.google.com with SMTP id c4so3905146ilq.13 for ; Thu, 17 Oct 2019 17:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4tqK11FCKTtpeNb/kdkdcZSh26BkLSHk7+0eLJudgpA=; b=ZvTWtpJ+nGkxprJPx8rmfN7XS5Qq2GtsH0AcO7eQ4AA+DVUuYgTUYKgLOfBC58zTdg MkX46qmHUxwbyjT5I+b4s5zYTfoA8wAdQi8yudp0VZQBtBDzIYvChI0fsvsHNsvl1Vjy K106IKyMVkt4xyN7MeQb5BXp3SKlNKfNnfGgi1WHub9iOlUnq9inCvPNvdvLrXp0+QdX SLc+d4YyumaMZ8yio9VNa4Eoe208BDnbf6RCi7UvBFdFUg300TbvbefHgxVTXLH75uSW i9I65+Y2vS28kr5uacQqvIrsyjCv8nmfdKdSY4aJOBRzFTGTGR/2K3BInGi+5HNHl5Ps /qww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4tqK11FCKTtpeNb/kdkdcZSh26BkLSHk7+0eLJudgpA=; b=daQkuwSxyJupoFdf7znVZx7NTRbAljjA0eBhaWiTwW0lHQpvQrOAv+bHAygxmdz0rz hGykwFxqMIpPIS92PUGFFbxTftkKbxWngvgMsaWQSNg5jA53inZx/C3SPDBXAlPSBiY4 vU/Y4IJagNGsRv3tNswoa4T6wai/BPX/m3gHcRKZiotcg5QXd9N6BygNIPbsD9KUUb8M tYzXrU/jpERQM1ieuROpyBDCyNUWoFrf5wwqtizHMaS2hP5XuwK6CFAfWIGpPBcMBvT/ hEhPpIms1Z9GOqvwSiHUdYBKUNWH+UCv+FB32zHI66mIBlCSFh0wgV4ofdHRDThYtRD1 Rpdg== X-Gm-Message-State: APjAAAXMRfBg+fFYo4lCMO8sAKBlD/qjHfOz9mtpSU5u+D1M+zK5GAKa sEg+FdTEBD8VEYylleKflQBH+A== X-Received: by 2002:a92:c6ca:: with SMTP id v10mr7634877ilm.133.1571359794270; Thu, 17 Oct 2019 17:49:54 -0700 (PDT) Received: from viisi.Home ([64.62.168.194]) by smtp.gmail.com with ESMTPSA id z20sm1493891iof.38.2019.10.17.17.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 17:49:53 -0700 (PDT) From: Paul Walmsley To: linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 4/8] riscv: ensure RISC-V C model definitions are passed to static analyzers Date: Thu, 17 Oct 2019 17:49:25 -0700 Message-Id: <20191018004929.3445-5-paul.walmsley@sifive.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191018004929.3445-1-paul.walmsley@sifive.com> References: <20191018004929.3445-1-paul.walmsley@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Static analysis tools such as sparse don't set the RISC-V C model preprocessor directives such as "__riscv_cmodel_medany", set by the C compilers. This causes the static analyzers to evaluate different preprocessor paths than C compilers would. Fix this by defining the appropriate C model macros in the static analyzer command lines. Signed-off-by: Paul Walmsley --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index f5e914210245..0247a90bd4d8 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -47,9 +47,11 @@ KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET) ifeq ($(CONFIG_CMODEL_MEDLOW),y) KBUILD_CFLAGS += -mcmodel=medlow + CHECKFLAGS += -D__riscv_cmodel_medlow endif ifeq ($(CONFIG_CMODEL_MEDANY),y) KBUILD_CFLAGS += -mcmodel=medany + CHECKFLAGS += -D__riscv_cmodel_medany endif ifeq ($(CONFIG_MODULE_SECTIONS),y) KBUILD_LDS_MODULE += $(srctree)/arch/riscv/kernel/module.lds -- 2.23.0