[llvm-dev] Windows JIT-Client and Emulated TLS

Gaier, Bjoern via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 21 22:52:36 PST 2019

Hello LLVM-World,

yeah... It's me again and still with the never ending (but cool) task of jitting BC files under windows.
My setup is: LLVM 7.0.0, with the corresponding Clang, Visual Studio 2017 (Clang integrated via "vix" installer) and my target is also windows x64.

I create BC files with clang-cl and have currently a new test code, which has a static variable inside a lambda function. This lambda function returns the address of this said variable.
As mention this code is compiled with clang-cl for windows in 64bit, generating a BC file.

When loading this file with my JIT-Client I get some undefined references which I could resolve - besides from two:
"__emutls_get_address" and "__emutls_v.xyz_" (xyz is just a place holder - don't remember what was written there)

I tried researching a bit and... I think this functions are related to emulating TLS?

So I look into the IR file but noticed that these function where not mentioned there. So I assumed they must be created by the JIT process, so I went there and looked for my "llvm::TargetOptions" and set these values explicit:
                                options.ThreadModel = llvm::ThreadModel::Single;
                                options.EmulatedTLS = false;
                                options.ExplicitEmulatedTLS = false;

Sadly this didn't changed a thing... Also setting "-Xclang -fno-emulated-tls" didn't worked, only setting the MSVC switch "/Zc:threadSafeInit-" helped but... obviously disabled TLS at all.

What options do I have? I found an implementation for "__emutls_get_address" in compiler-rt but no explanation what I should do with these "__emutls_v."-functions. Further, can't I just disable emulated-tls? My JIT-Client seemed to have ignored my wish...

I hope someone can help me with that :0
I'm still a beginner so... sorry for this question

Kind greetings and thank you
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190122/26a1640a/attachment.html>

More information about the llvm-dev mailing list