Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: luc.vanoostenryck@gmail.com (Luc Van Oostenryck)
To: linux-riscv@lists.infradead.org
Subject: [PATCH] riscv: pass machine size to sparse
Date: Mon, 28 May 2018 18:35:05 +0200	[thread overview]
Message-ID: <20180528163505.15698-1-luc.vanoostenryck@gmail.com> (raw)

By default, sparse assumes a 64bit machine when compiled on x86-64
and 32bit when compiled on anything else.

This can of course create all sort of problems when this doesn't
correspond to the target's machine size, like issuing false
warnings like: 'shift too big (32) for type unsigned long' or
is 64bit while sparse was compiled on a 32bit machine, or worse,
to not emit legitimate warnings.

Fix this by passing the appropriate -m32/-m64 flag to sparse.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 arch/riscv/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 76e958a54..cb2502e4c 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -71,6 +71,8 @@ KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax)
 # architectures.  It's faster to have GCC emit only aligned accesses.
 KBUILD_CFLAGS += $(call cc-option,-mstrict-align)
 
+CHECKFLAGS += -m$(BITS)
+
 head-y := arch/riscv/kernel/head.o
 
 core-y += arch/riscv/kernel/ arch/riscv/mm/
-- 
2.17.0

             reply	other threads:[~2018-05-28 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 16:35 Luc Van Oostenryck [this message]
2018-05-29  6:11 ` [PATCH] riscv: pass machine size to sparse Christoph Hellwig
2018-05-29  6:14   ` Masahiro Yamada
2018-05-31 12:09     ` Palmer Dabbelt
2018-05-31 15:35       ` Luc Van Oostenryck
2018-06-05  1:18         ` Palmer Dabbelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180528163505.15698-1-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-riscv@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox