From 145167650b96967d6b726efef978c74831e6b2bd Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 28 May 2018 20:27:35 +0200 Subject: kbuild: add endianness flag to CHEKCFLAGS The kernel depends on macros like __BYTE_ORDER__, __BIG_ENDIAN__ or __LITTLE_ENDIAN__. OTOH, sparse doesn't know about the endianness of the kernel and by default uses the same as the machine on which sparse was built. Ensure that sparse can predefine the macros corresponding to how the kernel was configured by adding -m{big,little}-endian to CHECKFLAGS in the main Makefile (and so for all archs). Also, remove the equivalent done in arch specific Makefiles. Signed-off-by: Luc Van Oostenryck Signed-off-by: Masahiro Yamada --- arch/parisc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/parisc') diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 34ac503e28ad..348ae4779f32 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -22,7 +22,7 @@ KBUILD_IMAGE := vmlinuz KBUILD_DEFCONFIG := default_defconfig NM = sh $(srctree)/arch/parisc/nm -CHECKFLAGS += -D__hppa__=1 -mbig-endian +CHECKFLAGS += -D__hppa__=1 LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) export LIBGCC -- cgit From 1f2f01b122d7c78a9e842a126ef168afb279552b Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Wed, 30 May 2018 22:48:38 +0200 Subject: kbuild: add machine size to CHECKFLAGS 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 for the other archs, like issuing false warnings ('shift too big (32) for type unsigned long'), or worse, failing to emit legitimate warnings. Fix this by adding the -m32/-m64 flag, depending on CONFIG_64BIT, to CHECKFLAGS in the main Makefile (and so for all archs). Also, remove the now unneeded -m32/-m64 in arch specific Makefiles. Signed-off-by: Luc Van Oostenryck Signed-off-by: Masahiro Yamada --- arch/parisc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/parisc') diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 348ae4779f32..714284ea6cc2 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -28,7 +28,7 @@ export LIBGCC ifdef CONFIG_64BIT UTS_MACHINE := parisc64 -CHECKFLAGS += -D__LP64__=1 -m64 +CHECKFLAGS += -D__LP64__=1 CC_ARCHES = hppa64 LD_BFD := elf64-hppa-linux else # 32-bit -- cgit