From patchwork Wed May 30 20:48:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 10439847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB952601E9 for ; Wed, 30 May 2018 20:49:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9548F28F46 for ; Wed, 30 May 2018 20:49:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D8429535; Wed, 30 May 2018 20:49:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 179EC28F46 for ; Wed, 30 May 2018 20:49:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932278AbeE3Ust (ORCPT ); Wed, 30 May 2018 16:48:49 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54505 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbeE3Usq (ORCPT ); Wed, 30 May 2018 16:48:46 -0400 Received: by mail-wm0-f68.google.com with SMTP id f6-v6so50130584wmc.4; Wed, 30 May 2018 13:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NxCegMAfjhY+CxljrV+ckItVZ7jwzw3nDyuhFpc4E94=; b=nwBjVmkH7XvZwQsq1OBotgSXyt0KJuAVT67pA933Pbc8VrfIzM/jeIWRGvATrcRDpG tIJMGowRbDjfk0QHuU4AKBxOjhbkARyJI6/bJJXDEDqw9bpMzZ5WhHppzDh19/jM4tD9 u20BghFGJID1ZdaEmBYwMLQA6Dlp/DKRcG+XLB97Bohfjpr2h0Ga0e1/R5QQ9npADBkx bWBOclYTbVqU3I4vQC8wx/KL4TUnMVAdT85WxnV0/jmxm8A+ixhGVQejEVO8rroPD0y3 cMIs4FUT9jqBl4Q5yun5ALbwiGYJqO9DaAVvfeF3eRHamJKFBAFaP6AJ5n9zCfz1S4Jx Un2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NxCegMAfjhY+CxljrV+ckItVZ7jwzw3nDyuhFpc4E94=; b=RG642yffn5+okSMgz72JB2Y4b0QSrDjqRgeV4VSxAgqQtomaAe0mz1rNqVnFJb6H2f Zi+ctk1Wdgamw+acG2obtqmhDd4UpXPMayYdbbrmEFi1O/MxNfn1qpcyXt8s55sehmcC s72DC6zab6sylTqrY9DqnAZcgg1LoVjjThSIlj6IyfbUq6CDzInmvYhe9IqWQu/8Ttac OUA2dWIKdnSRHzjcfQXIXvA4dpEs0YqFnGWt8+1cfM61sLVvORqfY8R5fRd+aGsOXjWs U+QRoR3mYRvueJRi2O+lyHZY7PH52PMrYQHU4gmstRVJgMPLD+HP2iQOYgGAk/cPN55s tBDw== X-Gm-Message-State: ALKqPwd0cHAbg6y0iek41dJmQmTvRYlgQr8F7KBDDXJwsKDB13ufQjLk az8H2PDS4R2qNLxJhRIntZQ= X-Google-Smtp-Source: ADUXVKINDuO0/TCwI7Elk9uJB+PeOccEzDuXpE3y7k4Jw/Ji4AM91DsuKRl9dnKVZJ0+Rgjaq+nPOg== X-Received: by 2002:a50:ee8c:: with SMTP id f12-v6mr5037375edr.10.1527713324852; Wed, 30 May 2018 13:48:44 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:405a:a00:51ca:be87:e123:c124]) by smtp.gmail.com with ESMTPSA id t3-v6sm11532044edh.53.2018.05.30.13.48.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 13:48:44 -0700 (PDT) From: Luc Van Oostenryck To: Masahiro Yamada Cc: Michal Marek , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Ralf Baechle , James Hogan , "James E . J . Bottomley" , Helge Deller , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Brendan Higgins , Martin Blumenstingl , Cao jin , Nicolas Pitre , =?UTF-8?q?Andreas=20F=C3=A4rber?= , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Randy Dunlap , Christoph Hellwig , Rob Landley , Luc Van Oostenryck Subject: [PATCH] kbuild: add machine size to CHEKCFLAGS Date: Wed, 30 May 2018 22:48:38 +0200 Message-Id: <20180530204838.22079-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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