Index: include/__cxxabi_config.h =================================================================== --- /dev/null +++ include/__cxxabi_config.h @@ -0,0 +1,20 @@ +//===-------------------------- __cxxabi_config.h -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef ____CXXABI_CONFIG_H +#define ____CXXABI_CONFIG_H + +#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ + !defined(__ARM_DWARF_EH__) +#define LIBCXXABI_ARM_EHABI 1 +#else +#define LIBCXXABI_ARM_EHABI 0 +#endif + +#endif // ____CXXABI_CONFIG_H Index: include/cxxabi.h =================================================================== --- include/cxxabi.h +++ include/cxxabi.h @@ -18,17 +18,11 @@ #include #include +#include <__cxxabi_config.h> + #define _LIBCPPABI_VERSION 1001 #define LIBCXXABI_NORETURN __attribute__((noreturn)) -// FIXME: This is also in unwind.h and libunwind.h, can we consolidate? -#if !defined(__USING_SJLJ_EXCEPTIONS__) && defined(__arm__) && \ - !defined(__ARM_DWARF_EH__) && !defined(__APPLE__) -#define LIBCXXABI_ARM_EHABI 1 -#else -#define LIBCXXABI_ARM_EHABI 0 -#endif - #ifdef __cplusplus namespace std { Index: include/libunwind.h =================================================================== --- include/libunwind.h +++ include/libunwind.h @@ -17,13 +17,7 @@ #include #include -// FIXME: This is also in unwind.h and cxxabi.h, can we consolidate? -#if !defined(__USING_SJLJ_EXCEPTIONS__) && defined(__arm__) && \ - !defined(__ARM_DWARF_EH__) && !defined(__APPLE__) -#define LIBCXXABI_ARM_EHABI 1 -#else -#define LIBCXXABI_ARM_EHABI 0 -#endif +#include <__cxxabi_config.h> #ifdef __APPLE__ #include Index: include/unwind.h =================================================================== --- include/unwind.h +++ include/unwind.h @@ -23,13 +23,7 @@ #define LIBUNWIND_UNAVAIL #endif -// FIXME: This is also in cxxabi.h and libunwind.h, can we consolidate? -#if !defined(__USING_SJLJ_EXCEPTIONS__) && defined(__arm__) && \ - !defined(__ARM_DWARF_EH__) && !defined(__APPLE__) -#define LIBCXXABI_ARM_EHABI 1 -#else -#define LIBCXXABI_ARM_EHABI 0 -#endif +#include <__cxxabi_config.h> typedef enum { _URC_NO_REASON = 0, @@ -208,9 +202,7 @@ _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass, uint32_t discriminator, _Unwind_VRS_DataRepresentation representation); -#endif -#if LIBCXXABI_ARM_EHABI static inline uintptr_t _Unwind_GetGR(struct _Unwind_Context* context, int index) { uintptr_t value = 0; Index: src/Unwind/Unwind-EHABI.h =================================================================== --- src/Unwind/Unwind-EHABI.h +++ src/Unwind/Unwind-EHABI.h @@ -11,6 +11,10 @@ #ifndef __UNWIND_EHABI_H__ #define __UNWIND_EHABI_H__ +#include <__cxxabi_config.h> + +#if LIBCXXABI_ARM_EHABI + #include #include @@ -44,6 +48,6 @@ } // extern "C" #endif -#endif +#endif // LIBCXXABI_ARM_EHABI #endif // __UNWIND_EHABI_H__ Index: src/Unwind/Unwind-EHABI.cpp =================================================================== --- src/Unwind/Unwind-EHABI.cpp +++ src/Unwind/Unwind-EHABI.cpp @@ -12,7 +12,7 @@ #include "Unwind-EHABI.h" -#include +#if LIBCXXABI_ARM_EHABI #include #include @@ -26,7 +26,6 @@ #include "unwind.h" #include "../private_typeinfo.h" -#if LIBCXXABI_ARM_EHABI namespace { // Strange order: take words in order, but inside word, take from most to least Index: src/Unwind/UnwindCursor.hpp =================================================================== --- src/Unwind/UnwindCursor.hpp +++ src/Unwind/UnwindCursor.hpp @@ -23,17 +23,15 @@ #include #endif -#include "libunwind.h" +#include "config.h" #include "AddressSpace.hpp" -#include "Registers.hpp" -#include "DwarfInstructions.hpp" #include "CompactUnwinder.hpp" #include "config.h" - -#if LIBCXXABI_ARM_EHABI +#include "DwarfInstructions.hpp" +#include "libunwind.h" +#include "Registers.hpp" #include "Unwind-EHABI.h" -#endif namespace libunwind { Index: src/Unwind/UnwindLevel1-gcc-ext.c =================================================================== --- src/Unwind/UnwindLevel1-gcc-ext.c +++ src/Unwind/UnwindLevel1-gcc-ext.c @@ -16,14 +16,11 @@ #include #include -#include "libunwind.h" -#include "unwind.h" -#include "libunwind_ext.h" #include "config.h" - -#if LIBCXXABI_ARM_EHABI +#include "libunwind_ext.h" +#include "libunwind.h" #include "Unwind-EHABI.h" -#endif +#include "unwind.h" #if _LIBUNWIND_BUILD_ZERO_COST_APIS