diff options
author | Kamil Rytarowski <n54@gmx.com> | 2017-06-22 13:18:46 +0000 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2017-06-22 13:18:46 +0000 |
commit | fb1808c254466ff19590b01e0a7e74356135fb74 (patch) | |
tree | 9a9f4b1aab163ddd2ee12e5a43d98e303e55ee90 | |
parent | 841b888a685e24020df2d74e51641887957438d9 (diff) |
[Solaris] replace Solaris.h hack with a set of better hacks
Summary:
Got rid of unwieldy -include Solaris.h portability solution, replacing it with interposed header and moving endian defines into Host.h.
Fixes PR28370.
Reviewers: joerg, alekseyshl, mgorny
Reviewed By: joerg
Subscribers: llvm-commits, mgorny, ro, krytarowski
Patch by Fedor Sergeev.
Differential Revision: https://reviews.llvm.org/D3413
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306002 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | include/llvm/Support/Host.h | 10 | ||||
-rw-r--r-- | include/llvm/Support/Solaris/sys/regset.h (renamed from include/llvm/Support/Solaris.h) | 20 | ||||
-rw-r--r-- | include/llvm/module.modulemap | 3 |
4 files changed, 17 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e701b14ee4f5..9cdc688d42b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -804,7 +804,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include llvm/Support/Solaris.h") + # special hack for Solaris to handle crazy system sys/regset.h + include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris") endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) # Make sure we don't get -rdynamic in every binary. For those that need it, diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h index 89986fdae971..be93dd99032e 100644 --- a/include/llvm/Support/Host.h +++ b/include/llvm/Support/Host.h @@ -21,6 +21,16 @@ #include <endian.h> #elif defined(_AIX) #include <sys/machine.h> +#elif defined(__sun) +/* Solaris provides _BIG_ENDIAN/_LITTLE_ENDIAN selector in sys/types.h */ +#include <sys/types.h> +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#if defined(_BIG_ENDIAN) +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif #else #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32) #include <machine/endian.h> diff --git a/include/llvm/Support/Solaris.h b/include/llvm/Support/Solaris/sys/regset.h index 88d83014c468..6a69ebe718a1 100644 --- a/include/llvm/Support/Solaris.h +++ b/include/llvm/Support/Solaris/sys/regset.h @@ -1,4 +1,4 @@ -/*===- llvm/Support/Solaris.h ------------------------------------*- C++ -*-===* +/*===- llvm/Support/Solaris/sys/regset.h ------------------------*- C++ -*-===* * * The LLVM Compiler Infrastructure * @@ -7,24 +7,14 @@ * *===----------------------------------------------------------------------===* * - * This file contains portability fixes for Solaris hosts. + * This file works around excessive name space pollution from the system header + * on Solaris hosts. * *===----------------------------------------------------------------------===*/ -#ifndef LLVM_SUPPORT_SOLARIS_H -#define LLVM_SUPPORT_SOLARIS_H +#ifndef LLVM_SUPPORT_SOLARIS_SYS_REGSET_H -#include <sys/regset.h> -#include <sys/types.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 +#include_next <sys/regset.h> #undef CS #undef DS diff --git a/include/llvm/module.modulemap b/include/llvm/module.modulemap index d906b05f7aaa..2557f5fa9701 100644 --- a/include/llvm/module.modulemap +++ b/include/llvm/module.modulemap @@ -275,9 +275,6 @@ module LLVM_Utils { umbrella "Support" module * { export * } - // Exclude this; it's only included on Solaris. - exclude header "Support/Solaris.h" - // Exclude this; it's fundamentally non-modular. exclude header "Support/PluginLoader.h" |