diff mbox

sh: pass endianness info to sparse

Message ID 20171031172218.10137-1-luc.vanoostenryck@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Luc Van Oostenryck Oct. 31, 2017, 5:22 p.m. UTC
sparse assumes the same endianness as the building machine.
This is problematic for code which expect __BYTE_ORDER__ being
correctly predefined by the compiler which sparse can then
pre-process differently from what gcc would, depending on the
building machine endianness.

Fix this by letting sparse know about the architecture endianness.

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 mbox

Patch

diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 280bbff12..93639dd5e 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -119,10 +119,12 @@  ifdef CONFIG_CPU_LITTLE_ENDIAN
 ld-bfd			:= elf32-$(UTS_MACHINE)-linux
 LDFLAGS_vmlinux		+= --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
 LDFLAGS			+= -EL
+CHECKFLAGS		+= -mlittle-endian
 else
 ld-bfd			:= elf32-$(UTS_MACHINE)big-linux
 LDFLAGS_vmlinux		+= --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
 LDFLAGS			+= -EB
+CHECKFLAGS		+= -mbig-endian
 endif
 
 export ld-bfd BITS