diff options
author | alpine-mips-patches <info@mobile-stream.com> | 2018-12-03 10:26:31 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@alpinelinux.org> | 2018-12-17 09:00:30 +0000 |
commit | 20b06b3a5a196d248d8b0e66fc1beb3925667c72 (patch) | |
tree | 75004c7d93f8829f7a2c953081d83b7b35b4a2ca /community/dynamips/detect-byte-order.patch | |
parent | 8b256dcd696715633a9f885f8e8e8de0017d8f9a (diff) | |
download | aports-20b06b3a5a196d248d8b0e66fc1beb3925667c72.tar.bz2 aports-20b06b3a5a196d248d8b0e66fc1beb3925667c72.tar.xz |
community/dynamips: fix byte order detection
Use the generic gcc/clang/suncc __BYTE_ORDER__ macro to detect platform
byte order instead of hard-coded architecture detection which is wrong
for ppc64le (always assumes POWER is big-endian) and lacks any knowledge
of mips*.
This change covers s390x too so remove s390x-support.patch.
Diffstat (limited to 'community/dynamips/detect-byte-order.patch')
-rw-r--r-- | community/dynamips/detect-byte-order.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/community/dynamips/detect-byte-order.patch b/community/dynamips/detect-byte-order.patch new file mode 100644 index 0000000000..0181be2a1d --- /dev/null +++ b/community/dynamips/detect-byte-order.patch @@ -0,0 +1,34 @@ +--- a/common/dynamips_common.h ++++ b/common/dynamips_common.h +@@ -50,21 +50,17 @@ + #define ARCH_BIG_ENDIAN 0x4321 + #define ARCH_LITTLE_ENDIAN 0x1234 + +-#if defined(PPC) || defined(__powerpc__) || defined(__ppc__) +-#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN +-#elif defined(__sparc) || defined(__sparc__) +-#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN +-#elif defined(__alpha) || defined(__alpha__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__i386) || defined(__i386__) || defined(i386) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN ++ ++#ifdef __BYTE_ORDER__ ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++#define ARCH_BYTE_ORDER ARCH_BIG_ENDIAN ++#else ++#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN ++#endif ++#endif ++ ++#if defined(__i386) || defined(__i386__) || defined(i386) + #define ARCH_REGPARM_SUPPORTED 1 +-#elif defined(__x86_64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__ia64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN +-#elif defined(__arm__) || defined (__aarch64__) +-#define ARCH_BYTE_ORDER ARCH_LITTLE_ENDIAN + #endif + + #ifndef ARCH_BYTE_ORDER |