Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933001AbdKAMU0 (ORCPT ); Wed, 1 Nov 2017 08:20:26 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:43167 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbdKAMUV (ORCPT ); Wed, 1 Nov 2017 08:20:21 -0400 X-Google-Smtp-Source: ABhQp+Q66TOQQaynXooxv0l2Xt3LN75c2EPlv82tst/f0SBbYVmlLFUr+gXPHKa5/hBTbMZg6P5yMQ== Date: Wed, 1 Nov 2017 21:20:18 +0900 From: Stafford Horne To: Luc Van Oostenryck Cc: LKML Subject: Re: [PATCH] openrisc: pass endianness info to sparse Message-ID: <20171101122018.GI29237@lianli.shorne-pla.net> References: <20171031172205.9892-1-luc.vanoostenryck@gmail.com> <20171101020047.GE29237@lianli.shorne-pla.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +CC List On Wed, Nov 01, 2017 at 05:34:29AM +0100, Luc Van Oostenryck wrote: > On Wed, Nov 1, 2017 at 3:00 AM, Stafford Horne wrote: > > On Tue, Oct 31, 2017 at 06:22:05PM +0100, Luc Van Oostenryck wrote: > >> openrisc is big-endian only but sparse assumes the same endianness > >> as the building machine. > >> This is problematic for code which expect __BYTE_ORDER__ being > >> correctly predefined by the compiler which sparse can then > >> pre-process differently from what gcc would, depending on the > >> building machine endianness. > >> > >> Fix this by letting sparse know about the architecture endianness. > > > > Thank You, > > > > I have applied this. I haven't really used sparse before, but it looks great. > > Just use 'make C=1' or 'make C=2' when compiling the kernel. > For endianness problems, sparse is invaluable as it does things no > others tools can. Right, I tried it out and it works well. Now I have a new tool to add to my workflow, and it looks like a few bugs to fix as well. > > Do you think openrisc needs to set other arguments like __BIG_ENDIAN__ as other > > architectures do? > > If you use a recent version of sparse (the version 0.5.1 released in August), > which I strongly advise, you don't need to as sparse then understand > -mbig-endian > and then define __BIG_ENDIAN__ internally, like GCC do. > But with older version of sparse, yes, it would also be needed as well > as __BYTE_ORDER__. I do have 0.5.1 so I should be good. -Stafford