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: 10439849 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 CC068601E9 for ; Wed, 30 May 2018 20:49:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3EB528C2B for ; Wed, 30 May 2018 20:49:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7E8C29533; Wed, 30 May 2018 20:49:10 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AEFF728C2B for ; Wed, 30 May 2018 20:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=iF6dxuexar2X7ZEsRrO2K31pl98bNz077PP5Wsm5gCI=; b=Oje AOJuhb8z9oUL3DkP0/e102Mu+Rb+utlPA0zQnfNTap91KV95MKTt6LRrqAe/DIcWjMQSW2Db4X7Ve hhZLfvIQe/xh/bqWNax1t4inuMS2JgjGfoQls68fy+nSQJzC5zMfQdS7JGcvcdX4r6GUJ5FFN1StI HnjWg4Z0aAgPGzjwudv7E/YpBLQtmEnBSteEjwgVrLJ0scg6SJNIX4K24BC8BwfipOme3H4PUtgyl OfR09LnciAl+6hlHY36LpQ1RJ7U1uhw+NrQUTd+4HHVb8E39rc7j/Qpth5DH/GEZeBWjD+cTNAELT i2C3HdhngIrxzg8SwYAhsFCUPpGq/Dg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fO81m-0000Sl-3a; Wed, 30 May 2018 20:49:02 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fO81j-0000QZ-7d for linux-arm-kernel@lists.infradead.org; Wed, 30 May 2018 20:49:00 +0000 Received: by mail-wm0-x244.google.com with SMTP id t11-v6so50174594wmt.0 for ; Wed, 30 May 2018 13:48:47 -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=kfXOysMKUJjiVeKKf2D4exMtMti/QGsZVRiS8wy8KIj3vsQKJLuKjxUe2dlKiaPBW3 /nqzU6DGcqRdxu1/KEiXjo/6MkX7PnJvGnO1LkMpMMvi4yyW/eNtXcpr51qop+jrAgJ3 1WH1L7NH5+KZ/2Zv1eommDiPXbo7QFskDkpnj7JVhxlJ/uCdLeVhTdA4NqinRr1uwEAe VsuFquzQJct0HRGhv3JuP6yoavIhbrIlHW1BHnMklLnwYeMVZ/G4R2UNYdcbMKsVU9/4 hqxjPN5k4N7+ANvo7wLxCDAGvZ74OjgGq3P5UdPih4+Yrabk3CWPJwNt9BVsWQY6jRZK mtgg== X-Gm-Message-State: ALKqPwcuo+6T5fzS/tH1z/1VjBGsKUEiOSJtOY8SllclNpZQ68BcHvLJ /3VGc1btxCT/vVrv8LLB7i8= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180530_134859_277539_680017AA X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, Catalin Marinas , Will Deacon , "James E . J . Bottomley" , "H . Peter Anvin" , sparclinux@vger.kernel.org, Helge Deller , x86@kernel.org, Russell King , Christoph Hellwig , Ingo Molnar , James Hogan , Matt Turner , Fenghua Yu , linux-kbuild@vger.kernel.org, Martin Blumenstingl , Brendan Higgins , Cao jin , Tony Luck , Ivan Kokshaysky , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Richard Henderson , Michal Marek , linux-parisc@vger.kernel.org, Randy Dunlap , linux-kernel@vger.kernel.org, Ralf Baechle , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Rob Landley , linux-alpha@vger.kernel.org, "David S . Miller" , Luc Van Oostenryck MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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