linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: add riscv-specific predefines to CHECKFLAGS
@ 2018-05-31 15:42 Luc Van Oostenryck
  2018-06-05  1:18 ` Palmer Dabbelt
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2018-05-31 15:42 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: Albert Ou, linux-riscv, linux-kernel, Luc Van Oostenryck

RISC-V uses the macro __riscv_xlen, predefined by GCC, to
make the distinction between 32 or 64 bit code.

However, sparse doesn't know anything about this macro
which lead to wrong warnings and failures.

Fix this by adding a define of __riscv_xlen to CHECKFLAGS
and add one for __riscv too.

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

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 76e958a54..6d4a5f6c3 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -71,6 +71,9 @@ 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)
 
+# arch specific predefines for sparse
+CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS)
+
 head-y := arch/riscv/kernel/head.o
 
 core-y += arch/riscv/kernel/ arch/riscv/mm/
-- 
2.17.1

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

* Re: [PATCH] riscv: add riscv-specific predefines to CHECKFLAGS
  2018-05-31 15:42 [PATCH] riscv: add riscv-specific predefines to CHECKFLAGS Luc Van Oostenryck
@ 2018-06-05  1:18 ` Palmer Dabbelt
  0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2018-06-05  1:18 UTC (permalink / raw)
  To: luc.vanoostenryck; +Cc: albert, linux-riscv, linux-kernel, luc.vanoostenryck

On Thu, 31 May 2018 08:42:01 PDT (-0700), luc.vanoostenryck@gmail.com wrote:
> RISC-V uses the macro __riscv_xlen, predefined by GCC, to
> make the distinction between 32 or 64 bit code.
>
> However, sparse doesn't know anything about this macro
> which lead to wrong warnings and failures.
>
> Fix this by adding a define of __riscv_xlen to CHECKFLAGS
> and add one for __riscv too.
>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  arch/riscv/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 76e958a54..6d4a5f6c3 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -71,6 +71,9 @@ 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)
>
> +# arch specific predefines for sparse
> +CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS)
> +
>  head-y := arch/riscv/kernel/head.o
>
>  core-y += arch/riscv/kernel/ arch/riscv/mm/

Thanks!

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 15:42 [PATCH] riscv: add riscv-specific predefines to CHECKFLAGS 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;
as well as URLs for NNTP newsgroup(s).