* [PATCH] sh: pass machine size to sparse
@ 2017-10-31 17:22 Luc Van Oostenryck
2018-05-28 16:40 ` Luc Van Oostenryck
0 siblings, 1 reply; 5+ messages in thread
From: Luc Van Oostenryck @ 2017-10-31 17:22 UTC (permalink / raw)
To: linux-sh
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, like issuing false
warnings like: 'constant ... is so big it is unsigned long long'
or 'shift too big (32) for type unsigned long' when the architecture
is 64bit while sparse was compiled on a 32bit machine, or worse,
to not emit legitimate warnings in the reverse situation.
Fix this by passing to sparse the appropriate -m32/-m64 flag
To: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Rich Felker <dalias@libc.org>
CC: linux-sh@vger.kernel.org
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
arch/sh/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 93639dd5e..f68918660 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -106,6 +106,7 @@ UTS_MACHINE := sh
BITS := 32
LDFLAGS_vmlinux += -e _stext
KBUILD_DEFCONFIG := shx3_defconfig
+CHECKFLAGS += -m32
else
UTS_MACHINE := sh64
BITS := 64
@@ -113,6 +114,7 @@ LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
--defsym phys_stext_shmedia=phys_stext+1 \
-e phys_stext_shmedia
KBUILD_DEFCONFIG := cayman_defconfig
+CHECKFLAGS += -m64
endif
ifdef CONFIG_CPU_LITTLE_ENDIAN
--
2.14.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] sh: pass machine size to sparse
@ 2018-05-28 16:40 ` Luc Van Oostenryck
0 siblings, 0 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2018-05-28 16:40 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel, Luc Van Oostenryck
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, like issuing false
warnings like: 'shift too big (32) for type unsigned long', or
worse, to not emit legitimate warnings.
Fix this by passing to sparse the appropriate -m32/-m64 flag
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
arch/sh/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 65300193b..3a195c9d5 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -206,6 +206,8 @@ ifeq ($(CONFIG_DWARF_UNWINDER),y)
KBUILD_CFLAGS += -fasynchronous-unwind-tables
endif
+CHECKFLAGS += -m$(BITS)
+
libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] sh: pass machine size to sparse
@ 2018-05-28 16:40 ` Luc Van Oostenryck
0 siblings, 0 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2018-05-28 16:40 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel, Luc Van Oostenryck
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, like issuing false
warnings like: 'shift too big (32) for type unsigned long', or
worse, to not emit legitimate warnings.
Fix this by passing to sparse the appropriate -m32/-m64 flag
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
arch/sh/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 65300193b..3a195c9d5 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -206,6 +206,8 @@ ifeq ($(CONFIG_DWARF_UNWINDER),y)
KBUILD_CFLAGS += -fasynchronous-unwind-tables
endif
+CHECKFLAGS += -m$(BITS)
+
libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sh: pass machine size to sparse
2018-05-28 16:40 ` Luc Van Oostenryck
@ 2018-05-30 14:41 ` Rob Landley
-1 siblings, 0 replies; 5+ messages in thread
From: Rob Landley @ 2018-05-30 14:41 UTC (permalink / raw)
To: Luc Van Oostenryck, Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel
On 05/28/2018 11:40 AM, Luc Van Oostenryck wrote:
> 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, like issuing false
> warnings like: 'shift too big (32) for type unsigned long', or
> worse, to not emit legitimate warnings.
>
> Fix this by passing to sparse the appropriate -m32/-m64 flag
$ ${CROSS_COMPILE}gcc -E -dM - < /dev/null | grep __SIZEOF_LONG__
#define __SIZEOF_LONG__ 8
You can ask the compiler, you don't need to redundantly add this to every
architecture's Makefile.
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sh: pass machine size to sparse
@ 2018-05-30 14:41 ` Rob Landley
0 siblings, 0 replies; 5+ messages in thread
From: Rob Landley @ 2018-05-30 14:41 UTC (permalink / raw)
To: Luc Van Oostenryck, Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel
On 05/28/2018 11:40 AM, Luc Van Oostenryck wrote:
> 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, like issuing false
> warnings like: 'shift too big (32) for type unsigned long', or
> worse, to not emit legitimate warnings.
>
> Fix this by passing to sparse the appropriate -m32/-m64 flag
$ ${CROSS_COMPILE}gcc -E -dM - < /dev/null | grep __SIZEOF_LONG__
#define __SIZEOF_LONG__ 8
You can ask the compiler, you don't need to redundantly add this to every
architecture's Makefile.
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-05-30 14:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 17:22 [PATCH] sh: pass machine size to sparse Luc Van Oostenryck
2018-05-28 16:40 ` Luc Van Oostenryck
2018-05-28 16:40 ` Luc Van Oostenryck
2018-05-30 14:41 ` Rob Landley
2018-05-30 14:41 ` Rob Landley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.