<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello LLVM-World,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">yeah... It's me again and still with the never ending (but cool) task of jitting BC files under windows.<o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal">As mention this code is compiled with clang-cl for windows in 64bit, generating a BC file.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When loading this file with my JIT-Client I get some undefined references which I could resolve - besides from two:<o:p></o:p></p>
<p class="MsoNormal">"__emutls_get_address" and "__emutls_v.xyz_" (xyz is just a place holder - don't remember what was written there)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I tried researching a bit and... I think this functions are related to emulating TLS?
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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:<o:p></o:p></p>
<p class="MsoNormal"> options.ThreadModel = llvm::ThreadModel::Single;<o:p></o:p></p>
<p class="MsoNormal"> options.EmulatedTLS = false;<o:p></o:p></p>
<p class="MsoNormal"> options.ExplicitEmulatedTLS = false;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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...<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I hope someone can help me with that :0<o:p></o:p></p>
<p class="MsoNormal">I'm still a beginner so... sorry for this question<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kind greetings and thank you<o:p></o:p></p>
<p class="MsoNormal">Björn<o:p></o:p></p>
</div>
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
</body>
</html>