<div dir="ltr">> <span style="font-size:12.8px">I’ve seen the same problem, but didn’t find solution back then.</span><br style="font-size:12.8px"><span style="font-size:12.8px">> I can give a hint that it is related to a thread local storage (notice TLS in the name).</span><br style="font-size:12.8px">><br style="font-size:12.8px"><span style="font-size:12.8px">> The same result can be reproduced by this simple program:</span><br style="font-size:12.8px">><br style="font-size:12.8px"><span style="font-size:12.8px">>    thread_local int x = 0;</span><br style="font-size:12.8px"><span style="font-size:12.8px">>    int main() {</span><br style="font-size:12.8px"><span style="font-size:12.8px">>      return 0;</span><br style="font-size:12.8px"><span style="font-size:12.8px">>    }</span><br style="font-size:12.8px">><br style="font-size:12.8px"><span style="font-size:12.8px">>When compiled into IR it produces similar error:</span><br style="font-size:12.8px">><br style="font-size:12.8px"><span style="font-size:12.8px">>LLVM ERROR: Cannot select: t19: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">i32* @x> 0 [TF=19]</span><br style="font-size:12.8px"><span style="font-size:12.8px">>  t18: i64 = TargetGlobalTLSAddress<i32* @x> 0 [TF=19]</span><br style="font-size:12.8px"><span style="font-size:12.8px">>In function: _ZTW1x</span><br><span class="gmail-mt-tool-email-notification-true"></span><span class="gmail-mt-tool-email-tracking-true"></span><br>interestingly this works on my machine.<div><br></div><div>llvm-ir attached<br><br><br></div><img width="0" height="0" class="mailtrack-img" src="https://mailtrack.io/trace/mail/4b96187ab446c9251e6a6c4513d06c71fab7ad5f.png?u=931501"></div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-07 15:31 GMT+00:00 Alex Denisov <span dir="ltr"><<a href="mailto:1101.debian@gmail.com" target="_blank">1101.debian@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’ve seen the same problem, but didn’t find solution back then.<br>
I can give a hint that it is related to a thread local storage (notice TLS in the name).<br>
<br>
The same result can be reproduced by this simple program:<br>
<br>
    thread_local int x = 0;<br>
    int main() {<br>
      return 0;<br>
    }<br>
<br>
When compiled into IR it produces similar error:<br>
<br>
LLVM ERROR: Cannot select: t19: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<<wbr>i32* @x> 0 [TF=19]<br>
  t18: i64 = TargetGlobalTLSAddress<i32* @x> 0 [TF=19]<br>
In function: _ZTW1x<br>
<span class=""><br>
> On 7 Feb 2017, at 16:13, Mehdi Amini via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> + LLVM-dev (clang is mostly about the frontend and this is a backend failure), you may have more change to get an answer.<br>
><br>
>> On Feb 6, 2017, at 5:49 AM, Gaetano Checinski via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Running the following code with clang++ -S -emit-llvm main.cpp && lli main.ll on Linux(Debian)<br>
>><br>
>> #include <future><br>
>><br>
>><br>
>><br>
>> int main () {<br>
>><br>
>><br>
>> return std::async([]{return 1;}).get();<br>
>> }<br>
>> fails to run on lli due to the following error:<br>
>><br>
>> LLVM ERROR: Cannot select: 0xd012e0:<br>
>><br>
>>      i64<br>
>> = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i8*<wbr>* @_ZSt15__once_callable> 0 [TF=10]<br>
>><br>
>><br>
>><br>
>> 0xd020c0: i64 = TargetGlobalTLSAddress<i8** @_ZSt15__once_callable> 0 [TF=10]<br>
>> In function: _ZSt9call_onceIMNSt13__future_<wbr>base13_State_<wbr>baseV2EFvPSt8functionIFSt10uni<wbr>que_ptrINS0_12_Result_<wbr>baseENS4_8_<wbr>DeleterEEvEEPbEJPS1_S9_SA_<wbr>EEvRSt9once_flagOT_DpOT0_<br>
>> Questions:<br>
>><br>
>> What does it mean?<br>
>><br>
>> Are there any compiler-flags that fix this problem?<br>
>><br>
>> what specific features is libstdc++ using that cause this issue ?<br>
>><br>
>> How does my problem relate to Bug 21431 ?<br>
>><br>
>> The motivation behind this questions is to understand the differences between libc++ and libstdc++ that leads to this specific error message (on Linux) in llvm's orcjit.<br>
>><br>
>><br>
>><br>
>> ps.: i've also asked this question in stackoverflow<br>
>><br>
>><br>
>><br>
>><br>
</span>>>  Sent with Mailtrack<br>
<div class="HOEnZb"><div class="h5">>><br>
>> ______________________________<wbr>_________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
><br>
> ______________________________<wbr>_________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br>
</div></div></blockquote></div><br></div>