[PATCH] XCore target add __LITTLE_ENDIAN__ defined macro

Richard Osborne richard at xmos.com
Fri Feb 14 02:54:16 PST 2014


Thanks for the explanation - in that case it sounds like adding the 
macro is the right thing to do.

On 13/02/14 13:16, robert lytton wrote:
>    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


-- 
Richard Osborne | XMOS
http://www.xmos.com




More information about the llvm-commits mailing list