[Skiboot] [RFC] Add support for glibc style endianess detection

Akshay Adiga akshay.adiga at linux.vnet.ibm.com
Thu May 4 13:51:28 AEST 2017


On 05/04/2017 08:13 AM, Akshay Adiga wrote:
>
> On 05/04/2017 03:26 AM, Benjamin Herrenschmidt wrote:
> > On Thu, 2017-05-04 at 01:37 +0530, Akshay Adiga wrote:
> > > CCAN defines HAVE_LITTLE_ENDIAN or HAVE_BIG_ENDIAN to endianess of the
> > > system and code developed on top of glibc expect __BYTE_ORDER to
> > > tell the endianess.
> > >
> > > Suggested-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> > > Signed-off-by: Akshay Adiga <akshay.adiga at linux.vnet.ibm.com>
> > > ---
> > > Other attempt:
> > > 1) when named as include/endian.h, conflicted with host include
> > > files (gcov build failed).
> >
> > I'd rather we fix the host include problem by using the proper
> > guards in that file for example if we can and call it "endian.h"
>
> I can do that.
>
> [snip..]
> > > --- a/include/skiboot.h
> > > +++ b/include/skiboot.h
> > > @@ -27,13 +27,13 @@
> > >  #include <errno.h>
> > >  #include <bitutils.h>
> > >  #include <types.h>
> > > +#include <glibc_endian.h>
>
> I can rename "glibc_endian.h" to "endian.h" and change include to :
> +#include "endian.h"
>
> Thanks Ben it works. posting it as patch now.

I am wrong it does not solve the issue. this file gets included,
as Makefile is adding "-I. -I include" explicitly. It fails to take
glibc include.

Let me explain what's happening.

I rename it as "endian.h"

build fails for extract-gcov.c as it expects GLIBC endian.h and not CCAN.

If i rename it as "/usr/include/endian.h" , it builds fine.

It used to work fine because $(SKIBOOT)/include/ will not have endian.h
and fall back to GLIBC include.

Is there a way around it ?



More information about the Skiboot mailing list