[llvm-dev] How to use thread local storage with ORC JIT?

Gaier, Bjoern via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 15 07:33:24 PST 2021


Hey Geoff,

Sadly this didn’t changed the undefined symbols I encounter :c

From: Geoff Levner <glevner at gmail.com>
Sent: 15 February 2021 11:18
To: Gaier, Bjoern <Bjoern.Gaier at horiba.com>
Cc: LLVM Developers Mailing List <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] How to use thread local storage with ORC JIT?

I am no expert, so take anything I say with a pinch of salt, but my understanding is that Orc JIT does not support native thread-local storage, it just emulates it. I think what you have to do is to compile your source code with Clang's -femulated-tls option, to avoid native thread-local storage calls.

Geoff

On Mon, Feb 15, 2021 at 9:07 AM Gaier, Bjoern via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
Hello everyone,

I'm using the ORC JIT to load and execute some IR files which I compiled with Clang-Cl from some source files - the host is Windows 64bit. Apparently, clang decided to generate code using the thread local storage for some of the code. When now loading and jitting those files I get the following undefined references:
__emutls_get_address
__emutls_v._Init_thread_epoch

A while ago I was told, that those references are coming from compiler-rt - so I build that project and at least I found "__emutls_get_address" in the "clang_rt.builtins-x86_64.lib" file. However, I haven't found "__emutls_v._Init_thread_epoch" anyway and don't know what to do with this symbol.

Any ideas?

Also, in case you see double - I asked this question in the LLVM Discord already with no big success...

Kind greetings
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, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
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, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210215/dd8078ef/attachment.html>


More information about the llvm-dev mailing list