I don't know if I'm setting the triple of my execution engine
correctly. This is leading to an issue where a struct `{i8,i64}` is not
getting the same layout as the ABI expects.
Where `module` is my `llvm::Module` with the generated IR code.
I'm using the triple `x86_64-pc-linux-gnu`, the same as clang on the
machine, but getting different alignments. I'm assuming the above is
somehow not creating the correct layout. Perhaps there's an ordering issue?
Taking one step back, I'm not clear I'm even setting the
triple/DataLayout on the module correctly:
module = new llvm::Module\( "test", \*llvm\_context \);
module\->setTargetTriple\( platform::target\->triple \);
Is that enough to create an appropriate DataLayout for the module? I
don't see anyway to convert a triple to a DataLayout, so I can't call
`setDataLayout`.
If those are still failing, it would be interesting to get the data layout string that you are getting from the ExecutionEngine instance and compare it to what you are expecting.
Yes, I think ordering was a problem. I've moved my target machine setup
to immediately after creating the `Module` now, before adding any IR,
and it seems to work.