tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: host endianness



> > In the native build of pcc(1), we use a pre-generated config.h which
> > contains HOST_(BIG|LITTLE)_ENDIAN and TARGET_(BIG|LITTLE)_ENDIAN
> > definitions which should really be provided at build time. I found
> > <bsd.endian.mk> which supplies TARGET_ENDIANNESS but nothing about the
> > host.
> >
> > Is it ok to add the test below so I can supply the HOST_*_ENDIAN symbol to
> > the pcc build as appropriate? Its basically a copy of the
> > MACHINE_ARCH/TARGET_ENDIANNESS test already there..
> 
> Hm, except that test doesn't actually work.. seems that HOST_ARCH is
> actually _HOST_ARCH and it's not always set.
> 
> any other suggestions to get the host endianness at build time?

With nbtool_config.h like src/sbin/disklabel/bswap.h?

---
#include <sys/types.h>

#if HAVE_NBTOOL_CONFIG_H
#ifndef BYTE_ORDER
#ifdef WORDS_BIGENDIAN
#define BYTE_ORDER              BIG_ENDIAN
#else
#define BYTE_ORDER              LITTLE_ENDIAN
#endif
#endif
#endif

#define HOST_BYTE_ORDER         BYTE_ORDER

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index