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

David Major via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 22 06:40:26 PST 2019


>                                 options.EmulatedTLS = false;
>                                 options.ExplicitEmulatedTLS = false;

It looks like you'll need to set ExplicitEmulatedTLS to true, in order
to say "I am making an explicit choice about options.EmulatedTLS":
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/TargetMachine.cpp#L205

On Tue, Jan 22, 2019 at 1:52 AM Gaier, Bjoern via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> 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
>
> Björn
>
> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list