path: root/Makefile
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-09 13:12:16 +0100
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-11-15 00:13:23 +0900
commit80591e61a0f7e88deaada69844e4a31280c4a38f (patch)
tree30bad55cd656dc200bb83ac12f70c9e0e1bc4913 /Makefile
parentsparc: vdso: fix build error of vdso32 (diff)
kbuild: tell sparse about the $ARCH
Sparse uses the same executable for all archs and uses flags like -m64, -mbig-endian or -D__arm__ for arch-specific parameters. But Sparse also uses value from the host machine used to build Sparse as default value for the target machine. This works, of course, well for native build but can create problems when cross-compiling, like defining both '__i386__' and '__arm__' when cross-compiling for arm on a x86-64 machine. Fix this by explicitely telling sparse the target architecture. Reported-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to '')
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 1d5298356ea8..42bfda209cb8 100644
--- a/Makefile
+++ b/Makefile
@@ -917,6 +917,9 @@ ifeq ($(CONFIG_RELR),y)
LDFLAGS_vmlinux += --pack-dyn-relocs=relr
+# make the checker run with the right architecture
+CHECKFLAGS += --arch=$(ARCH)
# insure the checker run with the right endianness
CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)