diff options
| author | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2016-09-28 10:57:15 +0000 |
|---|---|---|
| committer | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2016-09-28 10:57:15 +0000 |
| commit | 6264758cc8cd62205b9073828359fb866bc27d59 (patch) | |
| tree | f0cec253fb40c953f0cf60b52555c1088b3db75a /libunwind/src/Unwind_AppleExtras.cpp | |
| parent | 2593b402ced66c14e59f59fcbb2ce92a4e55a04d (diff) | |
| download | bcm5719-llvm-6264758cc8cd62205b9073828359fb866bc27d59.tar.gz bcm5719-llvm-6264758cc8cd62205b9073828359fb866bc27d59.zip | |
[libunwind] Add support for a single-threaded libunwind build
The EHABI unwinder is thread-agnostic, SJLJ unwinder and the DWARF unwinder have
a couple of pthread dependencies.
This patch makes it possible to build the whole of libunwind for a
single-threaded environment.
Reviewers: compnerd
Differential revision: https://reviews.llvm.org/D24984
llvm-svn: 282575
Diffstat (limited to 'libunwind/src/Unwind_AppleExtras.cpp')
| -rw-r--r-- | libunwind/src/Unwind_AppleExtras.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libunwind/src/Unwind_AppleExtras.cpp b/libunwind/src/Unwind_AppleExtras.cpp index b8baef5fa76..d8301c057f7 100644 --- a/libunwind/src/Unwind_AppleExtras.cpp +++ b/libunwind/src/Unwind_AppleExtras.cpp @@ -185,21 +185,29 @@ bool checkKeyMgrRegisteredFDEs(uintptr_t pc, void *&fde) { #if !defined(FOR_DYLD) && _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 - - - - |

