JIT simple module and accessing the value fails

I'm using the llvm-c API and want to use the JIT. I've created the following
module

; ModuleID = '_tmp'

@a = global i64 5

define i64 @__tempfunc() {
entry:
  %a_val = load i64* @a
  ret i64 %a_val
}

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.

"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