On Mon, Mar 23, 2020 at 11:28:00AM +0100, Martin Liška wrote:
> > > > You can use them but should be prepared for some fallback (e.g. 
> > > > endian.h,
> > > > whatever else).
> > > > And there is also PDP endian...
> > > 
> > > Huh, are we talking about something so complex like:
> > > https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/int_endianness.h
> > 
> > I'd say even that is very simplified.  E.g. on glibc there is <endian.h>
> > with its macros, etc.
> > 
> > > Btw. do we force our run-time libraries to be built with GCC?
> > 
> > Some of our run-time libraries rely on being built by GCC, sure.
> > But I thought include/ is shared with binutils and there we don't really say
> > which compiler must be used to compile it.
> 
> ... and can we then rely on configure detection of the endianess done by bfd 
> and gold:
> 
> gold/config.h:#define GOLD_DEFAULT_BIG_ENDIAN false
> 
> bfd/PORTING:
> TARGET_IS_BIG_ENDIAN_P
>       Should be defined if <target> is big-endian.

I don't think so.  That is about the target, but you care about the host.
Wouldn't it be much easier not to do this and simply use macros for bits
from the full 32-bit value (and use shifts)?

        Jakub

Reply via email to