Skip to content

Commit

Permalink
kbuild: tell sparse about the $ARCH
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Luc Van Oostenryck <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
lucvoo authored and masahir0y committed Nov 14, 2019
1 parent 5347291 commit 80591e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,9 @@ ifeq ($(CONFIG_RELR),y)
LDFLAGS_vmlinux += --pack-dyn-relocs=relr
endif

# 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)

Expand Down

0 comments on commit 80591e6

Please sign in to comment.