<div dir="ltr">Hi Geoff,<div><br></div><div>If you want to access the variable directly from JIT'd code you will need to compile the DSO with -femulated-tls. Alternatively you could introduce a wrapper function to return the variable's address.</div><div><br></div><div>This doesn't help you right now, but for what it is worth the road-map to native TLS is becoming clearer:</div><div><br></div><div>(1) Land the orcv1-removal branch.</div><div>(2) Land the ORC remote-target-support branch -- This breaks ORC up into three libraries: One for the JIT, one for the target process and one of shared data structures.</div><div>(3) Create an ORC runtime library. I'm not sure whether this should live in LLVM or compiler-rt, but it would include implementations of, among other things, native TLS variable setup.</div><div>(4) Teach JITLink to handle native TLS relocations. This should be relatively straightforward on MachO. It may be more involved for ELF, but I haven't had a chance to dig in to this yet.</div><div><br></div><div>Steps (1) and (2) are mostly done. Step (3) shouldn't be too difficult. Step (4) will be the interesting part. </div><div><br></div><div>-- Lang.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 28, 2020 at 7:35 AM Geoff Levner <<a href="mailto:glevner@gmail.com">glevner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi JITters,<br>
<br>
I have some JIT-compiled C++ code that uses symbols from a DSO which<br>
uses C++14's thread support library. When I compile it I get the<br>
following error message:<br>
<br>
Symbols not found: [ __emutls_v._ZSt15__once_callable,<br>
__emutls_v._ZSt11__once_call ]<br>
<br>
Those seem to correspond to std::__once_callable and std::__once_call,<br>
which are indeed present in the C++ standard library. And I imagine<br>
they are needed because the DSO makes calls to std::call_once(). But<br>
ORC seems to be looking for them with the prefix "__emutls_v".<br>
<br>
I had a similar problem in the past, which I thought Lang had fixed...<br>
See this thread:<br>
<br>
<a href="http://lists.llvm.org/pipermail/llvm-dev/2020-January/138402.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2020-January/138402.html</a><br>
<br>
Perhaps it wasn't as fixed as I thought? Or maybe there is something I<br>
need to do for JIT to fully support thread-local storage?<br>
<br>
Geoff<br>
</blockquote></div>