From b25731010333d1b7654d31a1a58c2bf1d3b6a177 Mon Sep 17 00:00:00 2001 From: Brandon Bergren Date: Wed, 23 Sep 2020 02:05:44 +0000 Subject: [PATCH] [PowerPC64LE] Fix gdtoa configurations on LE. gdtoa wins the award for "most outdated endianness naming convention" with its IEEE_8087 vs IEEE_MC68k defines. I had a good chuckle. Update softfloat and arith.h to adjust to BE or LE automatically based on the low level preprocessor defines. Fixes printf/scanf on PowerPC64LE, although there is still a problem lurking regarding Signalling NaNs... Sponsored by: Tag1 Consulting, Inc. --- lib/libc/powerpc/softfloat/powerpc-gcc.h | 4 ++++ lib/libc/powerpc64/arith.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lib/libc/powerpc/softfloat/powerpc-gcc.h b/lib/libc/powerpc/softfloat/powerpc-gcc.h index e2f8680dd74..0fbb8006e22 100644 --- a/lib/libc/powerpc/softfloat/powerpc-gcc.h +++ b/lib/libc/powerpc/softfloat/powerpc-gcc.h @@ -6,7 +6,11 @@ One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. ------------------------------------------------------------------------------- */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define LITTLEENDIAN +#else #define BIGENDIAN +#endif /* ------------------------------------------------------------------------------- diff --git a/lib/libc/powerpc64/arith.h b/lib/libc/powerpc64/arith.h index 3c35b80f35c..03a162fd035 100644 --- a/lib/libc/powerpc64/arith.h +++ b/lib/libc/powerpc64/arith.h @@ -11,8 +11,13 @@ * architecture. See contrib/gdtoa/gdtoaimp.h for details. */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define IEEE_8087 +#define Arith_Kind_ASL 1 +#else #define IEEE_MC68k #define Arith_Kind_ASL 2 +#endif #define Long int #define Intcast (int)(long) #define Double_Align -- 2.45.0