mstorsjo created this revision.

When targeting apple platforms, these functions are implemented in
Unwind_AppleExtras.cpp, but there's previously no implementation for
other platforms.

Does `__thread` have any specific runtime requirements on e.g. windows?


https://reviews.llvm.org/D38250

Files:
  src/Unwind-sjlj.c


Index: src/Unwind-sjlj.c
===================================================================
--- src/Unwind-sjlj.c
+++ src/Unwind-sjlj.c
@@ -465,4 +465,18 @@
   return 0;
 }
 
+#ifndef __APPLE__
+__thread struct _Unwind_FunctionContext *stack = NULL;
+
+_LIBUNWIND_HIDDEN
+struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() {
+  return stack;
+}
+
+_LIBUNWIND_HIDDEN
+void __Unwind_SjLj_SetTopOfFunctionStack(struct _Unwind_FunctionContext *fc) {
+  stack = fc;
+}
+#endif // !defined(__APPLE__)
+
 #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS)


Index: src/Unwind-sjlj.c
===================================================================
--- src/Unwind-sjlj.c
+++ src/Unwind-sjlj.c
@@ -465,4 +465,18 @@
   return 0;
 }
 
+#ifndef __APPLE__
+__thread struct _Unwind_FunctionContext *stack = NULL;
+
+_LIBUNWIND_HIDDEN
+struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() {
+  return stack;
+}
+
+_LIBUNWIND_HIDDEN
+void __Unwind_SjLj_SetTopOfFunctionStack(struct _Unwind_FunctionContext *fc) {
+  stack = fc;
+}
+#endif // !defined(__APPLE__)
+
 #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to