diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-30 16:48:38 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-31 22:36:58 -0400 |
| commit | 1f2f01b122d7c78a9e842a126ef168afb279552b (patch) | |
| tree | 1b1732ed86d8ff44efe1ee7812b26ee1741939b3 | |
| parent | 145167650b96967d6b726efef978c74831e6b2bd (diff) | |
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 <luc.vanoostenryck@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | arch/alpha/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm64/Makefile | 2 | ||||
| -rw-r--r-- | arch/ia64/Makefile | 2 | ||||
| -rw-r--r-- | arch/mips/Makefile | 3 | ||||
| -rw-r--r-- | arch/parisc/Makefile | 2 | ||||
| -rw-r--r-- | arch/sparc/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/Makefile | 2 |
9 files changed, 10 insertions, 10 deletions
| @@ -877,6 +877,9 @@ endif | |||
| 877 | # insure the checker run with the right endianness | 877 | # insure the checker run with the right endianness |
| 878 | CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) | 878 | CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) |
| 879 | 879 | ||
| 880 | # the checker needs the correct machine size | ||
| 881 | CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) | ||
| 882 | |||
| 880 | # Default kernel image to build when no specific target is given. | 883 | # Default kernel image to build when no specific target is given. |
| 881 | # KBUILD_IMAGE may be overruled on the command line or | 884 | # KBUILD_IMAGE may be overruled on the command line or |
| 882 | # set in the environment | 885 | # set in the environment |
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile index 2cc3cc519c54..c5ec8c09c0c6 100644 --- a/arch/alpha/Makefile +++ b/arch/alpha/Makefile | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | NM := $(NM) -B | 11 | NM := $(NM) -B |
| 12 | 12 | ||
| 13 | LDFLAGS_vmlinux := -static -N #-relax | 13 | LDFLAGS_vmlinux := -static -N #-relax |
| 14 | CHECKFLAGS += -D__alpha__ -m64 | 14 | CHECKFLAGS += -D__alpha__ |
| 15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 | 15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 |
| 16 | cflags-y += $(call cc-option, -fno-jump-tables) | 16 | cflags-y += $(call cc-option, -fno-jump-tables) |
| 17 | 17 | ||
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e4e537f27339..f32a5468d79f 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
| @@ -135,7 +135,7 @@ endif | |||
| 135 | KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm | 135 | KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm |
| 136 | KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float | 136 | KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float |
| 137 | 137 | ||
| 138 | CHECKFLAGS += -D__arm__ -m32 | 138 | CHECKFLAGS += -D__arm__ |
| 139 | 139 | ||
| 140 | #Default value | 140 | #Default value |
| 141 | head-y := arch/arm/kernel/head$(MMUEXT).o | 141 | head-y := arch/arm/kernel/head$(MMUEXT).o |
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 87f7d2f9f17c..3c353b4715dc 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile | |||
| @@ -78,7 +78,7 @@ LDFLAGS += -maarch64linux | |||
| 78 | UTS_MACHINE := aarch64 | 78 | UTS_MACHINE := aarch64 |
| 79 | endif | 79 | endif |
| 80 | 80 | ||
| 81 | CHECKFLAGS += -D__aarch64__ -m64 | 81 | CHECKFLAGS += -D__aarch64__ |
| 82 | 82 | ||
| 83 | ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) | 83 | ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) |
| 84 | KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds | 84 | KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds |
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 2dd7f519ad0b..45f59808b842 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
| @@ -18,7 +18,7 @@ READELF := $(CROSS_COMPILE)readelf | |||
| 18 | 18 | ||
| 19 | export AWK | 19 | export AWK |
| 20 | 20 | ||
| 21 | CHECKFLAGS += -m64 -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ | 21 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ |
| 22 | 22 | ||
| 23 | OBJCOPYFLAGS := --strip-all | 23 | OBJCOPYFLAGS := --strip-all |
| 24 | LDFLAGS_vmlinux := -static | 24 | LDFLAGS_vmlinux := -static |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 5e9fce076ab6..e2122cca4ae2 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
| @@ -309,9 +309,6 @@ ifdef CONFIG_MIPS | |||
| 309 | CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ | 309 | CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ |
| 310 | egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ | 310 | egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ |
| 311 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') | 311 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') |
| 312 | ifdef CONFIG_64BIT | ||
| 313 | CHECKFLAGS += -m64 | ||
| 314 | endif | ||
| 315 | endif | 312 | endif |
| 316 | 313 | ||
| 317 | OBJCOPYFLAGS += --remove-section=.reginfo | 314 | OBJCOPYFLAGS += --remove-section=.reginfo |
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 | |||
| 28 | 28 | ||
| 29 | ifdef CONFIG_64BIT | 29 | ifdef CONFIG_64BIT |
| 30 | UTS_MACHINE := parisc64 | 30 | UTS_MACHINE := parisc64 |
| 31 | CHECKFLAGS += -D__LP64__=1 -m64 | 31 | CHECKFLAGS += -D__LP64__=1 |
| 32 | CC_ARCHES = hppa64 | 32 | CC_ARCHES = hppa64 |
| 33 | LD_BFD := elf64-hppa-linux | 33 | LD_BFD := elf64-hppa-linux |
| 34 | else # 32-bit | 34 | else # 32-bit |
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index edac927e4952..966a13d2b127 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile | |||
| @@ -39,7 +39,7 @@ else | |||
| 39 | # sparc64 | 39 | # sparc64 |
| 40 | # | 40 | # |
| 41 | 41 | ||
| 42 | CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 | 42 | CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ |
| 43 | LDFLAGS := -m elf64_sparc | 43 | LDFLAGS := -m elf64_sparc |
| 44 | export BITS := 64 | 44 | export BITS := 64 |
| 45 | UTS_MACHINE := sparc64 | 45 | UTS_MACHINE := sparc64 |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 60135cbd905c..f0a6ea22429d 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
| @@ -94,7 +94,7 @@ ifeq ($(CONFIG_X86_32),y) | |||
| 94 | else | 94 | else |
| 95 | BITS := 64 | 95 | BITS := 64 |
| 96 | UTS_MACHINE := x86_64 | 96 | UTS_MACHINE := x86_64 |
| 97 | CHECKFLAGS += -D__x86_64__ -m64 | 97 | CHECKFLAGS += -D__x86_64__ |
| 98 | 98 | ||
| 99 | biarch := -m64 | 99 | biarch := -m64 |
| 100 | KBUILD_AFLAGS += -m64 | 100 | KBUILD_AFLAGS += -m64 |
