Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4872068imm; Wed, 30 May 2018 13:49:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKISfrTz9UqmRvMHMomHJh+lkZnsbp8/kLfuFBISFqhEqKvy4SsnCSw+biLSseBCkZIVoagl X-Received: by 2002:a63:798f:: with SMTP id u137-v6mr3386972pgc.202.1527713389059; Wed, 30 May 2018 13:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527713389; cv=none; d=google.com; s=arc-20160816; b=mnlw82ukKEZzM40zpbWSNuovPRYAz0N3N1O8yvEi/Gqdpv50DM0GP7/GKbjn18xGbx 0/0kWPUKeIrZkpXJubv/e5T0kG4W7ss/+WtLwkiFgDtnVIZLZsLIZQA9b+4B9julwQ6U lDElE0cVGbn0H4AEdIe/dfgaQYX43nZssfNIhdFDLkD1T3Z2G/kcgdXR3gs0yKFLNpaN 21utm0W5b8IjxOUTC2MuC8hddgwM/rbAR+0WmBkCfegNgarM1WulAdrcHt7biGNjjQNv aHNDI8KqtKKGeIzVJ2PKa1zdwNIqp91a3Blkmn1dcPFJt8gHeYRHJNVhYKoxUGWbZW1O xsvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=NxCegMAfjhY+CxljrV+ckItVZ7jwzw3nDyuhFpc4E94=; b=AyJ4HJB879UAxmokHS4dy2/Q+gYmHKk34XqDosZKffq1XOhlD0iKToM3yYJe1ku8do hyU900NUtWxPvwBNW8Ii8Z1FkYfQ3tNAH/zneb2vZemVm7DYxsO6+JGAWfwqLtzY67tT UL5wkxq8WV+4+9Z80erAEH7pvacA9YO8qGxb9DQd5iMxHCNAqzP4PwCgXm1idoAhLlgP NIryq55E1s9Kl0QAqMVUHE8zC7lmNKkke/E+CJKnZlCsA7hR3kZfqWeqY1yvW2l3wygu n2KCTn7tMy+5KWZElS5a8pPNdoz1phm1oYPdgOmMlLCXRCKA1eIcuf37Mp5dCTRX2cRF P7tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nwBjVmkH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8-v6si35333436ple.469.2018.05.30.13.49.35; Wed, 30 May 2018 13:49:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nwBjVmkH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932337AbeE3Usu (ORCPT + 99 others); Wed, 30 May 2018 16:48:50 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.17.0