[PATCH] XCore target add __LITTLE_ENDIAN__ defined macro
robert lytton
robert at xmos.com
Thu Feb 13 05:16:22 PST 2014
Hi Richard,
The lnt test-suite's file tools/TargetConfig.mk.in uses the macro to steer the testing viz:
#ifdef __LITTLE_ENDIAN__
ENDIAN := little
#else
ENDIAN := big
#endif
All targets get the define __BYTE_ORDER__ (added in GCC 4.6) viz:
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
However other targets do define additional endianess:
// AARCH64-NETBSD:#define __LITTLE_ENDIAN__ 1
// ARM:#define __LITTLE_ENDIAN__ 1
// ARMEABISOFTFP:#define __LITTLE_ENDIAN__ 1
// ARMEABIHARDFP:#define __LITTLE_ENDIAN__ 1
// I386:#define __LITTLE_ENDIAN__ 1
// I386-LINUX:#define __LITTLE_ENDIAN__ 1
// I386-NETBSD:#define __LITTLE_ENDIAN__ 1
// PPC603E:#define _BIG_ENDIAN 1
// PPC603E:#define __BIG_ENDIAN__ 1
// PPC64:#define _BIG_ENDIAN 1
// PPC64:#define __BIG_ENDIAN__ 1
// PPC64LE:#define _LITTLE_ENDIAN 1
// PPC64LE:#define __LITTLE_ENDIAN__ 1
// PPC64-LINUX:#define _BIG_ENDIAN 1
// PPC64-LINUX:#define __BIG_ENDIAN__ 1
// PPC:#define _BIG_ENDIAN 1
// PPC:#define __BIG_ENDIAN__ 1
// PPC-LINUX:#define _BIG_ENDIAN 1
// PPC-LINUX:#define __BIG_ENDIAN__ 1
// PPC-DARWIN:#define _BIG_ENDIAN 1
// PPC-DARWIN:#define __BIG_ENDIAN__ 1
// X86_64:#define __LITTLE_ENDIAN__ 1
// X86_64-LINUX:#define __LITTLE_ENDIAN__ 1
// X86_64-NETBSD:#define __LITTLE_ENDIAN__ 1
If we do not wish to define __LITTLE_ENDIAN__ we could either alter tools/TargetConfig.mk.in to use:
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
or we could explicitly add '__LITTLE_ENDIAN__' to the $(TARGET_FLAGS) we pass into lnt - which is the simplest option!
Robert
http://llvm-reviews.chandlerc.com/D2760
More information about the llvm-commits
mailing list