linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: pass machine size to sparse
Date: Tue, 31 Oct 2017 17:22:20 +0000	[thread overview]
Message-ID: <20171031172220.10186-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, 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


             reply	other threads:[~2017-10-31 17:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 17:22 Luc Van Oostenryck [this message]
2018-05-28 16:40 ` [PATCH] sh: pass machine size to sparse Luc Van Oostenryck
2018-05-30 14:41   ` Rob Landley

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=20171031172220.10186-1-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sh@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).