logan created this revision.
logan added reviewers: asl, joerg, rengolin, danalbert, compnerd.
logan added a subscriber: cfe-commits.

Introduce __libunwind_config.h to avoid cross repository circular
dependency with libcxxabi.

http://reviews.llvm.org/D11230

Files:
  include/__libunwind_config.h
  include/libunwind.h
  include/unwind.h
  src/AddressSpace.hpp
  src/Unwind-EHABI.cpp
  src/Unwind-EHABI.h
  src/UnwindCursor.hpp
  src/UnwindLevel1-gcc-ext.c
  src/UnwindLevel1.c
  src/libunwind.cpp
  src/libunwind_ext.h

Index: src/libunwind_ext.h
===================================================================
--- src/libunwind_ext.h
+++ src/libunwind_ext.h
@@ -33,7 +33,7 @@
 extern void _unw_add_dynamic_fde(unw_word_t fde);
 extern void _unw_remove_dynamic_fde(unw_word_t fde);
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*);
 extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context,
                                                  const uint32_t *data,
Index: src/libunwind.cpp
===================================================================
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -61,7 +61,7 @@
 #elif defined(__arm64__)
   new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm64>(
                                  context, LocalAddressSpace::sThisAddressSpace);
-#elif LIBCXXABI_ARM_EHABI
+#elif _LIBUNWIND_ARM_EHABI
   new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm>(
                                  context, LocalAddressSpace::sThisAddressSpace);
 #endif
@@ -205,7 +205,7 @@
 /// Set value of specified float register at cursor position in stack frame.
 _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
                                     unw_fpreg_t value) {
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)\n",
                        static_cast<void *>(cursor), regNum, value);
 #else
Index: src/UnwindLevel1.c
===================================================================
--- src/UnwindLevel1.c
+++ src/UnwindLevel1.c
@@ -23,7 +23,7 @@
 #include "unwind.h"
 #include "config.h"
 
-#if !LIBCXXABI_ARM_EHABI
+#if !_LIBUNWIND_ARM_EHABI
 
 static _Unwind_Reason_Code
 unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
@@ -530,5 +530,5 @@
   _Unwind_SetGR(context, 15, value | thumb_bit);
 }
 
-#endif // !LIBCXXABI_ARM_EHABI
+#endif // !_LIBUNWIND_ARM_EHABI
 
Index: src/UnwindLevel1-gcc-ext.c
===================================================================
--- src/UnwindLevel1-gcc-ext.c
+++ src/UnwindLevel1-gcc-ext.c
@@ -28,7 +28,7 @@
 ///  Called by __cxa_rethrow().
 _LIBUNWIND_EXPORT _Unwind_Reason_Code
 _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n",
                        (void *)exception_object,
                        (long)exception_object->unwinder_cache.reserved1);
@@ -38,7 +38,7 @@
                        (long)exception_object->private_1);
 #endif
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0,
   // which is in the same position as private_1 below.
   return _Unwind_RaiseException(exception_object);
@@ -111,7 +111,7 @@
   _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)\n",
                        (void *)(uintptr_t)callback);
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   // Create a mock exception object for force unwinding.
   _Unwind_Exception ex;
   memset(&ex, '\0', sizeof(ex));
@@ -122,7 +122,7 @@
   while (true) {
     _Unwind_Reason_Code result;
 
-#if !LIBCXXABI_ARM_EHABI
+#if !_LIBUNWIND_ARM_EHABI
     // ask libuwind to get next frame (skip over first frame which is
     // _Unwind_Backtrace())
     if (unw_step(&cursor) <= 0) {
@@ -154,7 +154,7 @@
             _URC_CONTINUE_UNWIND) {
       return _URC_END_OF_STACK;
     }
-#endif // LIBCXXABI_ARM_EHABI
+#endif // _LIBUNWIND_ARM_EHABI
 
     // debugging
     if (_LIBUNWIND_TRACING_UNWINDING) {
Index: src/UnwindCursor.hpp
===================================================================
--- src/UnwindCursor.hpp
+++ src/UnwindCursor.hpp
@@ -438,7 +438,7 @@
 
 private:
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   bool getInfoFromEHABISection(pint_t pc, const UnwindInfoSections &sects);
 
   int stepWithEHABI() {
@@ -634,7 +634,7 @@
   return _isSignalFrame;
 }
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 struct EHABIIndexEntry {
   uint32_t functionOffset;
   uint32_t data;
@@ -1163,7 +1163,7 @@
 template <typename A, typename R>
 void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
   pint_t pc = (pint_t)this->getReg(UNW_REG_IP);
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   // Remove the thumb bit so the IP represents the actual instruction address.
   // This matches the behaviour of _Unwind_GetIP on arm.
   pc &= (pint_t)~0x1;
@@ -1213,7 +1213,7 @@
     }
 #endif
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
     // If there is ARM EHABI unwind info, look there next.
     if (sects.arm_section != 0 && this->getInfoFromEHABISection(pc, sects))
       return;
@@ -1297,12 +1297,12 @@
   result = this->stepWithCompactEncoding();
 #elif _LIBUNWIND_SUPPORT_DWARF_UNWIND
   result = this->stepWithDwarfFDE();
-#elif LIBCXXABI_ARM_EHABI
+#elif _LIBUNWIND_ARM_EHABI
   result = this->stepWithEHABI();
 #else
   #error Need _LIBUNWIND_SUPPORT_COMPACT_UNWIND or \
               _LIBUNWIND_SUPPORT_DWARF_UNWIND or \
-              LIBCXXABI_ARM_EHABI
+              _LIBUNWIND_ARM_EHABI
 #endif
 
   // update info based on new PC
Index: src/Unwind-EHABI.h
===================================================================
--- src/Unwind-EHABI.h
+++ src/Unwind-EHABI.h
@@ -11,9 +11,9 @@
 #ifndef __UNWIND_EHABI_H__
 #define __UNWIND_EHABI_H__
 
-#include <__cxxabi_config.h>
+#include <__libunwind_config.h>
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 
 #include <stdint.h>
 #include <unwind.h>
@@ -46,6 +46,6 @@
 } // extern "C"
 #endif
 
-#endif // LIBCXXABI_ARM_EHABI
+#endif // _LIBUNWIND_ARM_EHABI
 
 #endif  // __UNWIND_EHABI_H__
Index: src/Unwind-EHABI.cpp
===================================================================
--- src/Unwind-EHABI.cpp
+++ src/Unwind-EHABI.cpp
@@ -12,7 +12,7 @@
 
 #include "Unwind-EHABI.h"
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 
 #include <stdbool.h>
 #include <stdint.h>
@@ -451,7 +451,7 @@
   // Walk each frame looking for a place to stop.
   for (bool handlerNotFound = true; handlerNotFound;) {
 
-#if !LIBCXXABI_ARM_EHABI
+#if !_LIBUNWIND_ARM_EHABI
     // Ask libuwind to get next frame (skip over first which is
     // _Unwind_RaiseException).
     int stepResult = unw_step(&cursor1);
@@ -585,7 +585,7 @@
       resume = false;
     }
 
-#if !LIBCXXABI_ARM_EHABI
+#if !_LIBUNWIND_ARM_EHABI
     int stepResult = unw_step(&cursor2);
     if (stepResult == 0) {
       _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
@@ -1006,4 +1006,4 @@
   return _URC_OK;
 }
 
-#endif  // LIBCXXABI_ARM_EHABI
+#endif  // _LIBUNWIND_ARM_EHABI
Index: src/AddressSpace.hpp
===================================================================
--- src/AddressSpace.hpp
+++ src/AddressSpace.hpp
@@ -34,7 +34,7 @@
 #include "dwarf2.h"
 #include "Registers.hpp"
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 #ifdef __linux__
 
 typedef long unsigned int *_Unwind_Ptr;
@@ -55,7 +55,7 @@
 extern EHTEntry __exidx_start;
 extern EHTEntry __exidx_end;
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
-#endif  // LIBCXXABI_ARM_EHABI
+#endif // _LIBUNWIND_ARM_EHABI
 
 #if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__)
 #if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX
@@ -92,7 +92,7 @@
   uintptr_t       compact_unwind_section;
   uintptr_t       compact_unwind_section_length;
 #endif
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   uintptr_t       arm_section;
   uintptr_t       arm_section_length;
 #endif
@@ -357,7 +357,7 @@
     info.compact_unwind_section_length = dyldInfo.compact_unwind_section_length;
     return true;
   }
-#elif LIBCXXABI_ARM_EHABI
+#elif _LIBUNWIND_ARM_EHABI
  #ifdef _LIBUNWIND_IS_BAREMETAL
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.arm_section =        (uintptr_t)(&__exidx_start);
Index: include/unwind.h
===================================================================
--- include/unwind.h
+++ include/unwind.h
@@ -14,6 +14,8 @@
 #ifndef __UNWIND_H__
 #define __UNWIND_H__
 
+#include <__libunwind_config.h>
+
 #include <stdint.h>
 #include <stddef.h>
 
@@ -23,8 +25,6 @@
 #define LIBUNWIND_UNAVAIL
 #endif
 
-#include <__cxxabi_config.h>
-
 typedef enum {
   _URC_NO_REASON = 0,
   _URC_OK = 0,
@@ -36,7 +36,7 @@
   _URC_HANDLER_FOUND = 6,
   _URC_INSTALL_CONTEXT = 7,
   _URC_CONTINUE_UNWIND = 8,
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
   _URC_FAILURE = 9
 #endif
 } _Unwind_Reason_Code;
@@ -51,7 +51,7 @@
 
 typedef struct _Unwind_Context _Unwind_Context;   // opaque
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 typedef uint32_t _Unwind_State;
 
 static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME   = 0;
@@ -164,7 +164,7 @@
 #endif
 extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);
 
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 typedef enum {
   _UVRSC_CORE = 0, /* integer register */
   _UVRSC_VFP = 1, /* vfp */
Index: include/libunwind.h
===================================================================
--- include/libunwind.h
+++ include/libunwind.h
@@ -14,11 +14,11 @@
 #ifndef __LIBUNWIND__
 #define __LIBUNWIND__
 
+#include <__libunwind_config.h>
+
 #include <stdint.h>
 #include <stddef.h>
 
-#include <__cxxabi_config.h>
-
 #ifdef __APPLE__
   #include <Availability.h>
     #ifdef __arm__
@@ -58,7 +58,7 @@
 typedef struct unw_addr_space *unw_addr_space_t;
 
 typedef int unw_regnum_t;
-#if LIBCXXABI_ARM_EHABI
+#if _LIBUNWIND_ARM_EHABI
 typedef uint32_t unw_word_t;
 typedef uint64_t unw_fpreg_t;
 #else
Index: include/__libunwind_config.h
===================================================================
--- /dev/null
+++ include/__libunwind_config.h
@@ -0,0 +1,20 @@
+//===------------------------- __libunwind_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 ____LIBUNWIND_CONFIG_H__
+#define ____LIBUNWIND_CONFIG_H__
+
+#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
+    !defined(__ARM_DWARF_EH__)
+#define _LIBUNWIND_ARM_EHABI 1
+#else
+#define _LIBUNWIND_ARM_EHABI 0
+#endif
+
+#endif // ____LIBUNWIND_CONFIG_H__
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to