Define BYTE_ORDER on Solaris.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 May 2013 20:36:13 +0000 (20:36 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 May 2013 20:36:13 +0000 (20:36 +0000)
Solaris doesn't have an endian.h header, but SPARC is the only
big-endian architecture that runs Solaris, so just use that to detect
endianness at compile time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182419 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Host.h
include/llvm/Support/Solaris.h

index 9a4036a8affbccee769195d07d0c559f113df2b1..7246f51457db703c7f48c2595bdee93b20b9b295 100644 (file)
@@ -19,7 +19,7 @@
 #if defined(__linux__)
 #include <endian.h>
 #else
-#ifndef LLVM_ON_WIN32
+#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
 #include <machine/endian.h>
 #endif
 #endif
index 6228c4b43b52566a0dea39ddff5f926fa9187f12..b0822853248956d83348d28725590189b181a178 100644 (file)
 #include <sys/types.h>
 #include <sys/regset.h>
 
+/* Solaris doesn't have endian.h. SPARC is the only supported big-endian ISA. */
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+#if defined(__sparc) || defined(__sparc__)
+#define BYTE_ORDER BIG_ENDIAN
+#else
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
 #undef CS
 #undef DS
 #undef ES