summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 9a4036a8af..7246f51457 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 6228c4b43b..b082285324 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