[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
Tue Sep 26 15:30:54 PDT 2017


mstorsjo added a comment.

In https://reviews.llvm.org/D38250#880871, @compnerd wrote:

> I have a complete implementation for this which is known to work on Windows at least.


Patches for libunwind, or standalone? In any case, please do share if you think it's relevant.

> The only thing that `__thread` requires is a working linker (which does not include binutils -- I do have a local patch to make that work though).

Ok, thanks for clarifying. (If I read wikipedia right, it requires Vista if built into a DLL that isn't linked to by an executable but loaded via LoadLibrary though.)

> Are these two the only ones that are missing?

As far as I've seen in my tests, these are the only ones missing yes. Most of the rest of `Unwind_AppleExtras.cpp` contains things not relating to SJLJ.

> At the very least, the implementation of `SetTopOfFunctionStack` is incorrect.

In which way? My implementation does pretty much exactly the same as the apple version of `SetTopOfFunctionStack`, but using a `__thread` variable instead of `_pthread_setspecific_direct(__PTK_LIBC_DYLD_Unwind_SjLj_Key, fc);`.


https://reviews.llvm.org/D38250





More information about the cfe-commits mailing list