[llvm] r182419 - Define BYTE_ORDER on Solaris.
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue May 21 13:36:14 PDT 2013
Author: stoklund
Date: Tue May 21 15:36:13 2013
New Revision: 182419
URL: http://llvm.org/viewvc/llvm-project?rev=182419&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Support/Host.h
llvm/trunk/include/llvm/Support/Solaris.h
Modified: llvm/trunk/include/llvm/Support/Host.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Host.h?rev=182419&r1=182418&r2=182419&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Host.h (original)
+++ llvm/trunk/include/llvm/Support/Host.h Tue May 21 15:36:13 2013
@@ -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
Modified: llvm/trunk/include/llvm/Support/Solaris.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Solaris.h?rev=182419&r1=182418&r2=182419&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Solaris.h (original)
+++ llvm/trunk/include/llvm/Support/Solaris.h Tue May 21 15:36:13 2013
@@ -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
More information about the llvm-commits
mailing list