Skip to contentSkip to conversation

arm64: pass endianness info to sparse

PATCH New Luc Van Oostenryck 2 participants 2 messages Jun 24, 2017 – Jun 26, 2017 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: pass endianness info to sparse

ARM64 depends on the macro __AARCH64EB__ being defined or not to correctly select or define endian-specific macros, structures or pieces of code.

This macro is predefined by the compiler but sparse knows nothing about it and thus may pre-process files differently from what gcc would.

Fix this by passing '-D__AARCH64EL__' or '-D__AARCH64EB__' to sparse depending of the endianness of the kernel, like defined by GCC.

Note: In most case it won't change anything since most arm64 use
little-endian (but an allyesconfig would use big-endian!).

CC Catalin Marinas <[email protected]>
CC Will Deacon <[email protected]>
CC linux-arm-kernel at lists.infradead.org
---
 arch/arm64/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/Makefile +2 -0
index 15d6c1476..8ed11b94a 100644
@@ -52,11 +52,13 @@ KBUILD_AFLAGS	+= $(lseinstr) $(brokengasinst)
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS	+= -mbig-endian
+CHECKFLAGS	+= -D__AARCH64EB__
 AS		+= -EB
 LD		+= -EB
 UTS_MACHINE	:= aarch64_be
 else
 KBUILD_CPPFLAGS	+= -mlittle-endian
+CHECKFLAGS	+= -D__AARCH64EL__
 AS		+= -EL
 LD		+= -EL
 UTS_MACHINE	:= aarch64
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/1 arm64: pass endianness info to sparse

Quoted 15 lines · Luc Van Oostenryck

ARM64 depends on the macro __AARCH64EB__ being defined or not to correctly select or define endian-specific macros, structures or pieces of code.

This macro is predefined by the compiler but sparse knows nothing about it and thus may pre-process files differently from what gcc would.

Fix this by passing '-D__AARCH64EL__' or '-D__AARCH64EB__' to sparse depending of the endianness of the kernel, like defined by GCC.

Note: In most case it won't change anything since most arm64 use
little-endian (but an allyesconfig would use big-endian!).

Quoted 7 lines
CC Catalin Marinas <[email protected]>
CC Will Deacon <[email protected]>
CC linux-arm-kernel at lists.infradead.org
---
 arch/arm64/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Thanks, I'll pick this up.

Will