aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-05-21 20:36:13 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-05-21 20:36:13 +0000
commit01ef4f6982451e6a7c00a713d9ae677d3a15d042 (patch)
tree56c3172ecb8a1814f4907fed026ef5db1833dd5c
parenta4ea4a72031809911d77f543eb65175e00fe914e (diff)
downloadexternal_llvm-01ef4f6982451e6a7c00a713d9ae677d3a15d042.zip
external_llvm-01ef4f6982451e6a7c00a713d9ae677d3a15d042.tar.gz
external_llvm-01ef4f6982451e6a7c00a713d9ae677d3a15d042.tar.bz2
Define BYTE_ORDER on Solaris.
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
-rw-r--r--include/llvm/Support/Host.h2
-rw-r--r--include/llvm/Support/Solaris.h9
2 files changed, 10 insertions, 1 deletions
diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h
index 9a4036a..7246f51 100644
--- a/include/llvm/Support/Host.h
+++ b/include/llvm/Support/Host.h
@@ -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
diff --git a/include/llvm/Support/Solaris.h b/include/llvm/Support/Solaris.h
index 6228c4b..b082285 100644
--- a/include/llvm/Support/Solaris.h
+++ b/include/llvm/Support/Solaris.h
@@ -17,6 +17,15 @@
#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