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.
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.