[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 22:57:07 PDT 2017


mstorsjo updated this revision to Diff 117089.
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Made the tls variable static, changed ifndef into !defined().


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;
 }
 
+#if !defined(__APPLE__)
+static __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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38250.117089.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170929/f473a086/attachment.bin>


More information about the cfe-commits mailing list