[LLVMdev] JIT simple module and accessing the value fails

Jonathan Roelofs jonathan at codesourcery.com
Thu Jan 8 09:10:48 PST 2015



On 1/8/15 9:52 AM, Tobias Pankrath wrote:
> On Thursday 08 January 2015 17:11:15 Tobias Pankrath wrote:
>> This output is generated by LLVMDumpModule just before I call
>> LLVMRunFunction. Which yields a LLVMGenericValueRef. However converting the
>> result to a 64bit integer via LLVMGenericValueToInt(gv, true), it results
>> in 360287970189639680 or something similar - not 5. Converting via
>> LLVMGenericValueToInt(gv, false) didn't help either.
>>
>> How can I use global variables in a JIT situation? Is anything wrong with
>> the IR?
>>
>
> Okay, I already figured out that it has to do with the datalayout. How do I
> set it correctly? I'm working on a linux x86_64 and I tried
> LLVMSetDataLayout(mod, "x86_64-pc-linux") which crashes the program with
>
>      LLVM ERROR: not a number, or does not fit in an unsigned int
>
> Using just LLVMSetDataLayout(mod, "e") solves it for now, would still like to
> know what the correct setting is / why x86_64-pc-linux does not work.

"x86_64-pc-linux" is a Triple, not a Data Layout: 
http://llvm.org/docs/LangRef.html#data-layout.

The name "Triple" here lies: 
http://llvm.org/docs/doxygen/html/group__LLVMCCoreModule.html#ga09bb21e82ee1df64fd387cd1498ceded 
Looks like a copy-pasta to me.


Jon

> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list