[LLVMdev] Accessing a global and MCJIT

Juan Manuel Martinez Caamaño jmartinezcaamao at gmail.com
Thu Jul 10 02:16:40 PDT 2014


Hello,
I'm having a problem while accessing a global variable from a Module
compiled by the MCJIT.

For context, I have two modules (namely A and B). *Module A* is compiled by
clang, while *Module B *is compiled by the MCJIT.

In *Module A* I defined a global variable like this:
*@A = common global [800 x [800 x double]] zeroinitializer, align 16*

*Module B*, references that global like this:
*@A = external global [800 x [800 x double]]*

The problem that I have is that the MCJIT is not able to solve the symbol
for @A. I get the following error:

*LLVM ERROR: Program used external function 'A' which could not be
resolved!*

As far as I know, the MCJIT by default uses dlsym to solve the symbols. I
tried to get the address for *@A* using dlsym, but i get NULL.

After compiling *Module A*, I used llvm-nm to check the symbol table:

*0000000000608540 B A*
0000000000aea540 B B
0000000000fcc540 B C
00000000006081c8 d _DYNAMIC
0000000000608480 d _GLOBAL_OFFSET_TABLE_
0000000000402460 R _IO_stdin_used
....

Any clues?

Thank you,
-- 
Juan Manuel Martinez Caamaño, MSc.
PhD. Student, IRMA - Université de Strasbourg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140710/e5026686/attachment.html>


More information about the llvm-dev mailing list