LLVM: segfault while modifying a thread-local global variable

Hi, guys.

Really strange situation: when I modify a thread-local GlobalVariable I get a segfault. It seems to be a bug, doesn’t it? Can u suggest me some solution?

Thanks.

Hi Semion,

Really strange situation: when I modify a thread-local GlobalVariable I get a
segfault. It seems to be a bug, doesn't it? Can u suggest me some solution?

build LLVM with assertions enabled. Then you may well get an assertion failure
with a helpful error message rather than an obscure crash.

Ciao, Duncan.

In my case the LLVM is built with assertions, but this doesn’t help. From your answer I conclude that thread-local globals are fully implemented in x86 JIT. So this is strange…

2011/11/9 Duncan Sands <baldrick@free.fr>

Hi Semion,

In my case the LLVM is built with assertions, but this doesn't help. From your
answer I conclude that thread-local globals are fully implemented in x86 JIT.

you didn't mention the JIT. You didn't give any details at all! That's why I
was only able to make a generic suggestion. Don't read too much into it.

Ciao, Duncan.

  So

OK, that’s my fault. I’m running jitted code on linux x86.

2011/11/9 Duncan Sands <baldrick@free.fr>

Which version of LLVM? At any rate I don’t recall TLS working for the JIT. It may take some work.

-eric

I use LLVM 2.9. By the way, I have another question. Is landingpad instruction is already implemented in JIT or I should use the old approach with llvm.eh instrinsics? Thanks.

2011/11/9 Eric Christopher <echristo@apple.com>

Not sure, you'd be best off looking into the code in top of tree and finding what fits your needs. You may need to do some work to get TLS and EH working in the JIT. It isn't a common code path for the JIT.

-eric