summaryrefslogtreecommitdiff
path: root/src/Unwind_AppleExtras.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Unwind_AppleExtras.cpp')
-rw-r--r--src/Unwind_AppleExtras.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/Unwind_AppleExtras.cpp b/src/Unwind_AppleExtras.cpp
index b8baef5..471059b 100644
--- a/src/Unwind_AppleExtras.cpp
+++ b/src/Unwind_AppleExtras.cpp
@@ -9,6 +9,7 @@
//===----------------------------------------------------------------------===//
#include "config.h"
+#include "AddressSpace.hpp"
#include "DwarfParser.hpp"
#include "unwind_ext.h"
@@ -76,7 +77,7 @@ struct libgcc_object_info {
#endif
-#if _LIBUNWIND_BUILD_ZERO_COST_APIS
+#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
//
// symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in
@@ -115,12 +116,12 @@ NEVER_HERE(__register_frame_table)
NEVER_HERE(__deregister_frame_info)
NEVER_HERE(__deregister_frame_info_bases)
-#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS
+#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
-#if _LIBUNWIND_BUILD_SJLJ_APIS
+#if defined(_LIBUNWIND_BUILD_SJLJ_APIS)
//
// symbols in libSystem.dylib in iOS 5.0 and later, but are in libgcc_s.dylib in
// earlier versions
@@ -140,7 +141,7 @@ NOT_HERE_BEFORE_5_0(_Unwind_SjLj_RaiseException)
NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume_or_Rethrow)
NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Unregister)
-#endif // _LIBUNWIND_BUILD_SJLJ_APIS
+#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS)
namespace libunwind {
@@ -183,23 +184,31 @@ bool checkKeyMgrRegisteredFDEs(uintptr_t pc, void *&fde) {
}
-#if !defined(FOR_DYLD) && _LIBUNWIND_BUILD_SJLJ_APIS
+#if !defined(FOR_DYLD) && defined(_LIBUNWIND_BUILD_SJLJ_APIS)
-#include <System/pthread_machdep.h>
+#ifndef _LIBUNWIND_HAS_NO_THREADS
+ #include <System/pthread_machdep.h>
+#else
+ _Unwind_FunctionContext *fc_ = nullptr;
+#endif
// Accessors to get get/set linked list of frames for sjlj based execeptions.
_LIBUNWIND_HIDDEN
struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() {
+#ifndef _LIBUNWIND_HAS_NO_THREADS
return (struct _Unwind_FunctionContext *)
_pthread_getspecific_direct(__PTK_LIBC_DYLD_Unwind_SjLj_Key);
+#else
+ return fc_;
+#endif
}
_LIBUNWIND_HIDDEN
void __Unwind_SjLj_SetTopOfFunctionStack(struct _Unwind_FunctionContext *fc) {
+#ifndef _LIBUNWIND_HAS_NO_THREADS
_pthread_setspecific_direct(__PTK_LIBC_DYLD_Unwind_SjLj_Key, fc);
+#else
+ fc_ = fc;
+#endif
}
#endif
-
-
-
-