Re: [PATCH] openrisc: pass endianness info to sparse

From: Stafford Horne
Date: Wed Nov 01 2017 - 08:20:29 EST


+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 <shorne@xxxxxxxxx> 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