<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I suspect this comes down to how your linking module A. If you
directly pointing MCJIT at the object file, the common declaration
is fine. If not, you probably need to mark this as an explicit
symbol. <br>
<br>
According to the LangRef, a common symbol is not necessarily
exported from the link step. As a result, if you're building a
shared library, the symbol won't be exported. <br>
<br>
Philip<br>
<br>
<div class="moz-cite-prefix">On 07/10/2014 02:16 AM, Juan Manuel
Martinez Caamaño wrote:<br>
</div>
<blockquote
cite="mid:CAAsOXR6o9tjug=9E396L6kjgTG0mgrhAEr0WoTLPbwt8_8RDBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>Hello,<br>
</div>
I'm having a problem while accessing a global variable from
a Module compiled by the MCJIT.<br>
</div>
<br>
</div>
<div>For context, I have two modules (namely A and B). <i>Module
A</i> is compiled by clang, while <i>Module B </i>is
compiled by the MCJIT.<br>
</div>
<div><br>
In <i>Module A</i> I defined a global variable like this:<br>
<i>@A = common global [800 x [800 x double]] zeroinitializer,
align 16</i><br>
<br>
</div>
<i>Module B</i>, references that global like this:<br>
<div>
<i>@A = external global [800 x [800 x double]]</i><br
clear="all">
<div>
<div>
<div>
<div>
<div><br>
</div>
<div>The problem that I have is that the MCJIT is not
able to solve the symbol for @A. I get the following
error:<br>
<br>
<div style="margin-left:40px"><i>LLVM ERROR: Program
used external function 'A' which could not be
resolved!</i><br>
</div>
<br>
As far as I know, the MCJIT by default uses dlsym to
solve the symbols. I tried to get the address for <i>@A</i>
using dlsym, but i get NULL.<br>
<br>
</div>
<div>After compiling <i>Module A</i>, I used llvm-nm
to check the symbol table:<br>
<br>
<div style="margin-left:40px"><b>0000000000608540 B
A</b><br>
0000000000aea540 B B<br>
0000000000fcc540 B C<br>
00000000006081c8 d _DYNAMIC<br>
0000000000608480 d _GLOBAL_OFFSET_TABLE_<br>
0000000000402460 R _IO_stdin_used<br>
....<br>
</div>
<br>
</div>
<div>Any clues?<br>
<br>
</div>
<div>Thank you,<br>
</div>
<div>-- <br>
<div dir="ltr">
<div><span style="color:rgb(102,102,102)"><font
face="arial, helvetica, sans-serif">Juan
Manuel Martinez Caamaño, </font><font
face="arial, helvetica, sans-serif">MSc.<br>
</font></span><font face="arial, helvetica,
sans-serif"><span
style="color:rgb(102,102,102)"><font
size="1">PhD. Student, IRMA - Université
de Strasbourg</font></span><br>
</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>