Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f2f01b1 authored by Luc Van Oostenryck's avatar Luc Van Oostenryck Committed by Masahiro Yamada
Browse files

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: default avatarLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 14516765
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -877,6 +877,9 @@ endif
# insure the checker run with the right endianness
# insure the checker run with the right endianness
CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)


# the checker needs the correct machine size
CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)

# Default kernel image to build when no specific target is given.
# Default kernel image to build when no specific target is given.
# KBUILD_IMAGE may be overruled on the command line or
# KBUILD_IMAGE may be overruled on the command line or
# set in the environment
# set in the environment
+1 −1
Original line number Original line Diff line number Diff line
@@ -11,7 +11,7 @@
NM := $(NM) -B
NM := $(NM) -B


LDFLAGS_vmlinux	:= -static -N #-relax
LDFLAGS_vmlinux	:= -static -N #-relax
CHECKFLAGS	+= -D__alpha__ -m64
CHECKFLAGS	+= -D__alpha__
cflags-y	:= -pipe -mno-fp-regs -ffixed-8
cflags-y	:= -pipe -mno-fp-regs -ffixed-8
cflags-y	+= $(call cc-option, -fno-jump-tables)
cflags-y	+= $(call cc-option, -fno-jump-tables)


+1 −1
Original line number Original line Diff line number Diff line
@@ -135,7 +135,7 @@ endif
KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
KBUILD_AFLAGS	+=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
KBUILD_AFLAGS	+=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float


CHECKFLAGS	+= -D__arm__ -m32
CHECKFLAGS	+= -D__arm__


#Default value
#Default value
head-y		:= arch/arm/kernel/head$(MMUEXT).o
head-y		:= arch/arm/kernel/head$(MMUEXT).o
+1 −1
Original line number Original line Diff line number Diff line
@@ -78,7 +78,7 @@ LDFLAGS += -maarch64linux
UTS_MACHINE	:= aarch64
UTS_MACHINE	:= aarch64
endif
endif


CHECKFLAGS	+= -D__aarch64__ -m64
CHECKFLAGS	+= -D__aarch64__


ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
KBUILD_LDFLAGS_MODULE	+= -T $(srctree)/arch/arm64/kernel/module.lds
KBUILD_LDFLAGS_MODULE	+= -T $(srctree)/arch/arm64/kernel/module.lds
+1 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@ READELF := $(CROSS_COMPILE)readelf


export AWK
export AWK


CHECKFLAGS	+= -m64 -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__
CHECKFLAGS	+= -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__


OBJCOPYFLAGS	:= --strip-all
OBJCOPYFLAGS	:= --strip-all
LDFLAGS_vmlinux	:= -static
LDFLAGS_vmlinux	:= -static
Loading