Message ID | 20180530204838.22079-1-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Luc, The typo in the subject made me curious... Am 30.05.2018 um 22:48 schrieb Luc Van Oostenryck: > 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> > --- > Makefile | 3 +++ > arch/alpha/Makefile | 2 +- > arch/arm/Makefile | 2 +- > arch/arm64/Makefile | 2 +- > arch/ia64/Makefile | 2 +- > arch/mips/Makefile | 3 --- > arch/parisc/Makefile | 2 +- > arch/sparc/Makefile | 2 +- > arch/x86/Makefile | 2 +- > 9 files changed, 10 insertions(+), 10 deletions(-) What about the architectures not touched by your patch that previously had no -m32/-m64? (arc, c6x, h8300, hexagon, m68k, microblaze, nds32, nios2, openrisc, powerpc, riscv, s390, sh, unicore32, xtensa) You forgot to CC them on this patch. Have you really checked that all their toolchains support the -m32/-m64 flags you newly introduce for them? Apart from non-biarch architectures, I'm thinking of 31-bit s390 as a corner case where !64 != 32. Regards, Andreas
On 05/30/2018 05:00 PM, Andreas Färber wrote: > What about the architectures not touched by your patch that previously > had no -m32/-m64? (arc, c6x, h8300, hexagon, m68k, microblaze, nds32, > nios2, openrisc, powerpc, riscv, s390, sh, unicore32, xtensa) > > You forgot to CC them on this patch. A) He cc'd arch/sh on the previous patch earlier today, to which I replied: https://marc.info/?l=linux-sh&m=152769132515226&w=2 B) Every change to common infrastructure should cc: every arch? Really? So like filesystem changes and stuff to? > Have you really checked that all their toolchains support the -m32/-m64 > flags you newly introduce for them? Apart from non-biarch architectures, > I'm thinking of 31-bit s390 as a corner case where !64 != 32. 1) Last I heard Linux implements lp64: http://www.unix.org/whitepapers/64bit.html 2) it's unlikely to be worse than it was before the patch, 3) last I checked https://github.com/landley/mkroot boots to an s390 shell prompt under qemu, although I haven't tried building with this patch. (And you may still need to add HOST_EXTRA='lex yacc bison flex' to the command line unless they've re-added the _shipped versions like the old kconfig had...) Point is, shouldn't be too hard to test it. Presumably that's why we have an -rc1 and then 6 more -rc versions each release... Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, May 31, 2018 at 12:00 AM, Andreas Färber <afaerber@suse.de> wrote: > Hi Luc, > > The typo in the subject made me curious... > > Am 30.05.2018 um 22:48 schrieb Luc Van Oostenryck: >> 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> >> --- >> Makefile | 3 +++ >> arch/alpha/Makefile | 2 +- >> arch/arm/Makefile | 2 +- >> arch/arm64/Makefile | 2 +- >> arch/ia64/Makefile | 2 +- >> arch/mips/Makefile | 3 --- >> arch/parisc/Makefile | 2 +- >> arch/sparc/Makefile | 2 +- >> arch/x86/Makefile | 2 +- >> 9 files changed, 10 insertions(+), 10 deletions(-) > > What about the architectures not touched by your patch that previously > had no -m32/-m64? (arc, c6x, h8300, hexagon, m68k, microblaze, nds32, > nios2, openrisc, powerpc, riscv, s390, sh, unicore32, xtensa) As explained in the patch, by default sparse uses -m64 if compiled on x86-64 and 32bit on everything else (well, more recent versions use -m64 if compiled on any 64 bit machine). I think that most ppc devs use a ppc machine and so ppc was most probably fine (at least ppc64) but I suspect that most of these others archs either had never sparse used on them or had a lot of wrong warnings. IOW, it was maybe OK but most probably incorrect for them and now it is OK. > You forgot to CC them on this patch. I didn't thought/knew it was needed and the CC list is already quite long but, if needed, no problem for me. > Have you really checked that all their toolchains support the -m32/-m64 > flags you newly introduce for them? Apart from non-biarch architectures, > I'm thinking of 31-bit s390 as a corner case where !64 != 32. Hmm, there is no change to anything I call 'toolchain related', like compiler and linker. The only change is sparse (or any other checker) receiving now a correct and explicit -m32 or -m64. For s390, as far as I know: 1) it has CONFIG_64BIT unconditionally definee (because the old 31bit is no more supported, now everything is s390x only). 2) even if the *address space* was only 31 bit, I'm very sure that sizeof(long) and sizeof(void*) was 4 on these machine hence -m32 would have been correct. Best regards, -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/30/2018 04:06 PM, Luc Van Oostenryck wrote: > On Thu, May 31, 2018 at 12:00 AM, Andreas Färber <afaerber@suse.de> wrote: >> Hi Luc, >> >> The typo in the subject made me curious... >> >> Am 30.05.2018 um 22:48 schrieb Luc Van Oostenryck: >>> 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> >>> --- >>> Makefile | 3 +++ >>> arch/alpha/Makefile | 2 +- >>> arch/arm/Makefile | 2 +- >>> arch/arm64/Makefile | 2 +- >>> arch/ia64/Makefile | 2 +- >>> arch/mips/Makefile | 3 --- >>> arch/parisc/Makefile | 2 +- >>> arch/sparc/Makefile | 2 +- >>> arch/x86/Makefile | 2 +- >>> 9 files changed, 10 insertions(+), 10 deletions(-) >> >> What about the architectures not touched by your patch that previously >> had no -m32/-m64? (arc, c6x, h8300, hexagon, m68k, microblaze, nds32, >> nios2, openrisc, powerpc, riscv, s390, sh, unicore32, xtensa) > > As explained in the patch, by default sparse uses -m64 if compiled on x86-64 > and 32bit on everything else (well, more recent versions use -m64 if > compiled on any 64 bit machine). I think that most ppc devs use a ppc > machine and so ppc was most probably fine (at least ppc64) but I suspect > that most of these others archs either had never sparse used on them > or had a lot of wrong warnings. IOW, it was maybe OK but most probably > incorrect for them and now it is OK. > >> You forgot to CC them on this patch. > > I didn't thought/knew it was needed and the CC list is already > quite long but, if needed, no problem for me. Ideally, adding linux-arch@vger.kernel.org would be sufficient, but sadly I have doubts about that. >> Have you really checked that all their toolchains support the -m32/-m64 >> flags you newly introduce for them? Apart from non-biarch architectures, >> I'm thinking of 31-bit s390 as a corner case where !64 != 32. > > Hmm, there is no change to anything I call 'toolchain related', like > compiler and linker. The only change is sparse (or any other checker) > receiving now a correct and explicit -m32 or -m64. > > For s390, as far as I know: > 1) it has CONFIG_64BIT unconditionally definee (because the old 31bit > is no more supported, now everything is s390x only). > 2) even if the *address space* was only 31 bit, I'm very sure > that sizeof(long) and sizeof(void*) was 4 on these machine > hence -m32 would have been correct.
2018-05-31 8:06 GMT+09:00 Luc Van Oostenryck <luc.vanoostenryck@gmail.com>: > On Thu, May 31, 2018 at 12:00 AM, Andreas Färber <afaerber@suse.de> wrote: >> Hi Luc, >> >> The typo in the subject made me curious... >> >> Am 30.05.2018 um 22:48 schrieb Luc Van Oostenryck: >>> 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> >>> --- >>> Makefile | 3 +++ >>> arch/alpha/Makefile | 2 +- >>> arch/arm/Makefile | 2 +- >>> arch/arm64/Makefile | 2 +- >>> arch/ia64/Makefile | 2 +- >>> arch/mips/Makefile | 3 --- >>> arch/parisc/Makefile | 2 +- >>> arch/sparc/Makefile | 2 +- >>> arch/x86/Makefile | 2 +- >>> 9 files changed, 10 insertions(+), 10 deletions(-) >> >> What about the architectures not touched by your patch that previously >> had no -m32/-m64? (arc, c6x, h8300, hexagon, m68k, microblaze, nds32, >> nios2, openrisc, powerpc, riscv, s390, sh, unicore32, xtensa) > > As explained in the patch, by default sparse uses -m64 if compiled on x86-64 > and 32bit on everything else (well, more recent versions use -m64 if > compiled on any 64 bit machine). I think that most ppc devs use a ppc > machine and so ppc was most probably fine (at least ppc64) but I suspect > that most of these others archs either had never sparse used on them > or had a lot of wrong warnings. IOW, it was maybe OK but most probably > incorrect for them and now it is OK. > >> You forgot to CC them on this patch. > > I didn't thought/knew it was needed and the CC list is already > quite long but, if needed, no problem for me. > >> Have you really checked that all their toolchains support the -m32/-m64 >> flags you newly introduce for them? Apart from non-biarch architectures, >> I'm thinking of 31-bit s390 as a corner case where !64 != 32. > > Hmm, there is no change to anything I call 'toolchain related', like > compiler and linker. The only change is sparse (or any other checker) > receiving now a correct and explicit -m32 or -m64. Right. We are talking about sparse. Nobody needs to test vmlinux or whatever objects. Except the typo in the subject (I can locally fix it up, though), this patch looks good to me. > For s390, as far as I know: > 1) it has CONFIG_64BIT unconditionally definee (because the old 31bit > is no more supported, now everything is s390x only). > 2) even if the *address space* was only 31 bit, I'm very sure > that sizeof(long) and sizeof(void*) was 4 on these machine > hence -m32 would have been correct. > > Best regards, > -- Luc > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 30, 2018 at 10:48:38PM +0200, Luc Van Oostenryck wrote: > 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> Looks like a good clean up to me. However the typo in the Subject: line did attract my attention. Daniel. > --- > Makefile | 3 +++ > arch/alpha/Makefile | 2 +- > arch/arm/Makefile | 2 +- > arch/arm64/Makefile | 2 +- > arch/ia64/Makefile | 2 +- > arch/mips/Makefile | 3 --- > arch/parisc/Makefile | 2 +- > arch/sparc/Makefile | 2 +- > arch/x86/Makefile | 2 +- > 9 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/Makefile b/Makefile > index 6c6610913..18379987c 100644 > --- a/Makefile > +++ b/Makefile > @@ -881,6 +881,9 @@ endif > # insure the checker run with the right endianness > 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. > # KBUILD_IMAGE may be overruled on the command line or > # set in the environment > diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile > index 2cc3cc519..c5ec8c09c 100644 > --- a/arch/alpha/Makefile > +++ b/arch/alpha/Makefile > @@ -11,7 +11,7 @@ > NM := $(NM) -B > > LDFLAGS_vmlinux := -static -N #-relax > -CHECKFLAGS += -D__alpha__ -m64 > +CHECKFLAGS += -D__alpha__ > cflags-y := -pipe -mno-fp-regs -ffixed-8 > cflags-y += $(call cc-option, -fno-jump-tables) > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index e4e537f27..f32a5468d 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -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_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float > > -CHECKFLAGS += -D__arm__ -m32 > +CHECKFLAGS += -D__arm__ > > #Default value > head-y := arch/arm/kernel/head$(MMUEXT).o > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 87f7d2f9f..3c353b471 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -78,7 +78,7 @@ LDFLAGS += -maarch64linux > UTS_MACHINE := aarch64 > endif > > -CHECKFLAGS += -D__aarch64__ -m64 > +CHECKFLAGS += -D__aarch64__ > > ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) > KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds > diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile > index 2dd7f519a..45f59808b 100644 > --- a/arch/ia64/Makefile > +++ b/arch/ia64/Makefile > @@ -18,7 +18,7 @@ READELF := $(CROSS_COMPILE)readelf > > 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 > LDFLAGS_vmlinux := -static > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > index 5e9fce076..e2122cca4 100644 > --- a/arch/mips/Makefile > +++ b/arch/mips/Makefile > @@ -309,9 +309,6 @@ ifdef CONFIG_MIPS > CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ > egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ > sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') > -ifdef CONFIG_64BIT > -CHECKFLAGS += -m64 > -endif > endif > > OBJCOPYFLAGS += --remove-section=.reginfo > diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile > index 348ae4779..714284ea6 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 > diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile > index edac927e4..966a13d2b 100644 > --- a/arch/sparc/Makefile > +++ b/arch/sparc/Makefile > @@ -39,7 +39,7 @@ else > # sparc64 > # > > -CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 > +CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ > LDFLAGS := -m elf64_sparc > export BITS := 64 > UTS_MACHINE := sparc64 > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 60135cbd9..f0a6ea224 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -94,7 +94,7 @@ ifeq ($(CONFIG_X86_32),y) > else > BITS := 64 > UTS_MACHINE := x86_64 > - CHECKFLAGS += -D__x86_64__ -m64 > + CHECKFLAGS += -D__x86_64__ > > biarch := -m64 > KBUILD_AFLAGS += -m64 > -- > 2.17.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2018-05-31 5:48 GMT+09:00 Luc Van Oostenryck <luc.vanoostenryck@gmail.com>: > 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> > --- Fixed CHEKCFLAGS -> CHECKFLAGS and applied to linux-kbuild. Thanks! > Makefile | 3 +++ > arch/alpha/Makefile | 2 +- > arch/arm/Makefile | 2 +- > arch/arm64/Makefile | 2 +- > arch/ia64/Makefile | 2 +- > arch/mips/Makefile | 3 --- > arch/parisc/Makefile | 2 +- > arch/sparc/Makefile | 2 +- > arch/x86/Makefile | 2 +- > 9 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/Makefile b/Makefile > index 6c6610913..18379987c 100644 > --- a/Makefile > +++ b/Makefile > @@ -881,6 +881,9 @@ endif > # insure the checker run with the right endianness > 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. > # KBUILD_IMAGE may be overruled on the command line or > # set in the environment > diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile > index 2cc3cc519..c5ec8c09c 100644 > --- a/arch/alpha/Makefile > +++ b/arch/alpha/Makefile > @@ -11,7 +11,7 @@ > NM := $(NM) -B > > LDFLAGS_vmlinux := -static -N #-relax > -CHECKFLAGS += -D__alpha__ -m64 > +CHECKFLAGS += -D__alpha__ > cflags-y := -pipe -mno-fp-regs -ffixed-8 > cflags-y += $(call cc-option, -fno-jump-tables) > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index e4e537f27..f32a5468d 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -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_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float > > -CHECKFLAGS += -D__arm__ -m32 > +CHECKFLAGS += -D__arm__ > > #Default value > head-y := arch/arm/kernel/head$(MMUEXT).o > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 87f7d2f9f..3c353b471 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -78,7 +78,7 @@ LDFLAGS += -maarch64linux > UTS_MACHINE := aarch64 > endif > > -CHECKFLAGS += -D__aarch64__ -m64 > +CHECKFLAGS += -D__aarch64__ > > ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) > KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds > diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile > index 2dd7f519a..45f59808b 100644 > --- a/arch/ia64/Makefile > +++ b/arch/ia64/Makefile > @@ -18,7 +18,7 @@ READELF := $(CROSS_COMPILE)readelf > > 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 > LDFLAGS_vmlinux := -static > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > index 5e9fce076..e2122cca4 100644 > --- a/arch/mips/Makefile > +++ b/arch/mips/Makefile > @@ -309,9 +309,6 @@ ifdef CONFIG_MIPS > CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ > egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ > sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') > -ifdef CONFIG_64BIT > -CHECKFLAGS += -m64 > -endif > endif > > OBJCOPYFLAGS += --remove-section=.reginfo > diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile > index 348ae4779..714284ea6 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 > diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile > index edac927e4..966a13d2b 100644 > --- a/arch/sparc/Makefile > +++ b/arch/sparc/Makefile > @@ -39,7 +39,7 @@ else > # sparc64 > # > > -CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 > +CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ > LDFLAGS := -m elf64_sparc > export BITS := 64 > UTS_MACHINE := sparc64 > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 60135cbd9..f0a6ea224 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -94,7 +94,7 @@ ifeq ($(CONFIG_X86_32),y) > else > BITS := 64 > UTS_MACHINE := x86_64 > - CHECKFLAGS += -D__x86_64__ -m64 > + CHECKFLAGS += -D__x86_64__ > > biarch := -m64 > KBUILD_AFLAGS += -m64 > -- > 2.17.0 >
diff --git a/Makefile b/Makefile index 6c6610913..18379987c 100644 --- a/Makefile +++ b/Makefile @@ -881,6 +881,9 @@ endif # insure the checker run with the right endianness 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. # KBUILD_IMAGE may be overruled on the command line or # set in the environment diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile index 2cc3cc519..c5ec8c09c 100644 --- a/arch/alpha/Makefile +++ b/arch/alpha/Makefile @@ -11,7 +11,7 @@ NM := $(NM) -B LDFLAGS_vmlinux := -static -N #-relax -CHECKFLAGS += -D__alpha__ -m64 +CHECKFLAGS += -D__alpha__ cflags-y := -pipe -mno-fp-regs -ffixed-8 cflags-y += $(call cc-option, -fno-jump-tables) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e4e537f27..f32a5468d 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -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_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float -CHECKFLAGS += -D__arm__ -m32 +CHECKFLAGS += -D__arm__ #Default value head-y := arch/arm/kernel/head$(MMUEXT).o diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 87f7d2f9f..3c353b471 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -78,7 +78,7 @@ LDFLAGS += -maarch64linux UTS_MACHINE := aarch64 endif -CHECKFLAGS += -D__aarch64__ -m64 +CHECKFLAGS += -D__aarch64__ ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 2dd7f519a..45f59808b 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile @@ -18,7 +18,7 @@ READELF := $(CROSS_COMPILE)readelf 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 LDFLAGS_vmlinux := -static diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 5e9fce076..e2122cca4 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -309,9 +309,6 @@ ifdef CONFIG_MIPS CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') -ifdef CONFIG_64BIT -CHECKFLAGS += -m64 -endif endif OBJCOPYFLAGS += --remove-section=.reginfo diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 348ae4779..714284ea6 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 diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index edac927e4..966a13d2b 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -39,7 +39,7 @@ else # sparc64 # -CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 +CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ LDFLAGS := -m elf64_sparc export BITS := 64 UTS_MACHINE := sparc64 diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 60135cbd9..f0a6ea224 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -94,7 +94,7 @@ ifeq ($(CONFIG_X86_32),y) else BITS := 64 UTS_MACHINE := x86_64 - CHECKFLAGS += -D__x86_64__ -m64 + CHECKFLAGS += -D__x86_64__ biarch := -m64 KBUILD_AFLAGS += -m64
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> --- Makefile | 3 +++ arch/alpha/Makefile | 2 +- arch/arm/Makefile | 2 +- arch/arm64/Makefile | 2 +- arch/ia64/Makefile | 2 +- arch/mips/Makefile | 3 --- arch/parisc/Makefile | 2 +- arch/sparc/Makefile | 2 +- arch/x86/Makefile | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-)