Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2952283imm; Mon, 28 May 2018 20:47:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpo6UOoVqdbVF+cQSdediHV+xZfbhJBYEoRhjMnGUnYvtG7zHnSWZ/xI1yFxT9LswfC+1Y1 X-Received: by 2002:a17:902:6e08:: with SMTP id u8-v6mr15763567plk.96.1527565637351; Mon, 28 May 2018 20:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527565637; cv=none; d=google.com; s=arc-20160816; b=fY6MKJM/7FA0Qn6UQk9aPfPkklqlZswakJ8cFX9W4gt/45VbWJhKZd+0aITNVXrltp n3DCsBRDXioY1NwP02RnavQXIQlwnHp9p0sErE+e9+IjCDwGh5iw8Rreyrt3dDN2d+gy 1lFAhppiiQf2daP/aTcTzWXDmZhc6HINpHj6v7vJ7vq8gm4gOSavzljfGki0YGoVJ8Zs 7m1Od6NHSZBIpY8FSQvSx83wPJO7ThGdvUw1z9EZDHwQFTCByps6x0IB6SjWXvyrOPit T31MK/iFf0jGbfTWwEdV1TRBbHam2vweecbq0yogHvHyyc/VGVEgZWHu5yjCVxSaSAyM 6N+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=el83o7qDecNZF/O0hd/IQnNvowCgnCiE+rQQ9GxihKM=; b=z5iuCn3t675nIzjvu0SJxEdHS77vKakFGCZRzIzcM22ADTad94PzHly4Es7OE9UKhP TcEDVY65KL4f442c/mISynxPgZyD4a+X50l68xo1PxWaQWmQqWUQ15WOLn3qxwvPUZ3f +JRqzbmc1dFa4nc7loOnV/if8Es5pZEpPuP38bdpV26ND4sqIgQkdRVavChjscbOwPOq +Ub3OK3DUnIVFhwr2AFym8XZUAasFDt51MMsr79Pwbqa22Cz0moGGVOEaO9Ta/dawdNe DEiQ7XMaKfsyYJkLMfvIMiiZl5sAOu0JVP6Gdd79ElFMIcPmtMtxd1kOrITtjxIAZX+5 HguQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=oTO3CxZF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s83-v6si31758423pfg.175.2018.05.28.20.46.23; Mon, 28 May 2018 20:47:17 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=oTO3CxZF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754564AbeE1RcM (ORCPT + 99 others); Mon, 28 May 2018 13:32:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51964 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754443AbeE1RcJ (ORCPT ); Mon, 28 May 2018 13:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=el83o7qDecNZF/O0hd/IQnNvowCgnCiE+rQQ9GxihKM=; b=oTO3CxZFS0qDyywygwHzDft7ul WTzyHuVrdUbDu1cwRNNXQD/iBDGiU54kCXACxF6dQWcYFy2ew5qPgpLiTBQJ71INog5FDAiRrLyCu huvY4avLCqG+0siQorz2mJny+geD4KFWjzD6nGl4PEqFf4oqMswD12z5/57Q9oEP/17AUrmpZkVOq lU1z3pJFe8uBvt5PVp/5l7i8FANzIdF14tiy0nV+FuZIZ8efg9ws24RkIidD0eV2P49rVKJ0jnExx aZT6u8KLtrssSdlnPlJ75Um01cG9P4ayGhm5AfMNTHdYJQppq4fp8gUNL3rbg/J0WZTADqA5M0IlQ w7DLrB+g==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNM01-0005jr-2E; Mon, 28 May 2018 17:32:01 +0000 Subject: Re: [PATCH] kbuild: add endianness flag to CHEKCFLAGS To: Luc Van Oostenryck , Masahiro Yamada , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Martin Schwidefsky , Heiko Carstens Cc: Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linux-s390@vger.kernel.org References: <20180528170048.16595-1-luc.vanoostenryck@gmail.com> From: Randy Dunlap Message-ID: <7ce087bc-dd52-bae8-96f2-fad91f5a345e@infradead.org> Date: Mon, 28 May 2018 10:31:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180528170048.16595-1-luc.vanoostenryck@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/28/2018 10:00 AM, Luc Van Oostenryck wrote: > The kernel depends on macros like __BYTE_ORDER__, > __BIG_ENDIAN__ or __LITTLE_ENDIAN__. > > OTOH, sparse doesn't know about the endianness of the kernel and > by default uses the same as the machine on which sparse was built. > > Ensure that sparse can predefine the macros corresponding to > how the kernel was configured by adding -m{big,little}-endian > to CHECKFLAGS in the main Makefile (and so for all archs). > Also, remove the equivalent done in arch specific Makefiles. > > Signed-off-by: Luc Van Oostenryck > --- > Makefile | 3 +++ > arch/openrisc/Makefile | 1 - > arch/parisc/Makefile | 2 +- > arch/s390/Makefile | 2 +- > 4 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/Makefile b/Makefile > index 56ba070df..057a278d2 100644 > --- a/Makefile > +++ b/Makefile > @@ -878,6 +878,9 @@ ifeq ($(CONFIG_STRIP_ASM_SYMS),y) > LDFLAGS_vmlinux += $(call ld-option, -X,) > endif > > +# insure the checker run with the right endianness > +CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig,-mlittle) Does this need to be -mbig-endian,-mlittle-endian) > + > # 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/openrisc/Makefile b/arch/openrisc/Makefile > index cf8802962..89076a66e 100644 > --- a/arch/openrisc/Makefile > +++ b/arch/openrisc/Makefile > @@ -25,7 +25,6 @@ LDFLAGS_vmlinux := > LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) > > KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ > -CHECKFLAGS += -mbig-endian > > ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y) > KBUILD_CFLAGS += $(call cc-option,-mhard-mul) > diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile > index 34ac503e2..348ae4779 100644 > --- a/arch/parisc/Makefile > +++ b/arch/parisc/Makefile > @@ -22,7 +22,7 @@ KBUILD_IMAGE := vmlinuz > KBUILD_DEFCONFIG := default_defconfig > > NM = sh $(srctree)/arch/parisc/nm > -CHECKFLAGS += -D__hppa__=1 -mbig-endian > +CHECKFLAGS += -D__hppa__=1 > LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) > export LIBGCC > > diff --git a/arch/s390/Makefile b/arch/s390/Makefile > index c79936d02..68a690442 100644 > --- a/arch/s390/Makefile > +++ b/arch/s390/Makefile > @@ -18,7 +18,7 @@ KBUILD_CFLAGS += -m64 > KBUILD_AFLAGS += -m64 > UTS_MACHINE := s390x > STACK_SIZE := 16384 > -CHECKFLAGS += -D__s390__ -D__s390x__ -mbig-endian > +CHECKFLAGS += -D__s390__ -D__s390x__ > > export LD_BFD > > -- ~Randy