Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: pass machine size to sparse
@ 2018-05-28 16:35 Luc Van Oostenryck
  2018-05-29  6:11 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Luc Van Oostenryck @ 2018-05-28 16:35 UTC (permalink / raw)
  To: linux-riscv

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-05  1:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 16:35 [PATCH] riscv: pass machine size to sparse Luc Van Oostenryck
2018-05-29  6:11 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox