MCJIT - missing DataLayout?

Hi everyone,

I was happily using MCJIT for over a year until yesterday when I created a function call with an argument of a struct type. That caused a crash in SelectionDAG around DataLayout::getAlignment().

I remember the noise about the DataLayout started being mandatory. But I cannot find precise information.

Should I set the DataLayout in every Module created?

Where can I get the DataLayout for the host process from?

Can a DataLayout instance be shared between modules?

  • Paweł


Hopefully this provides a partial answer: when using MCJIT I set the data layout for every module. My code looks roughly like:



Another approach that we use - we just wipe the DataLayout on the module about to be handed to the ExecutionEngine, and in MCJIT.cpp there is a line that says ‘if datalayout isDefault() (eg. empty string representation “”) set it to the datalayout of the Target Machine’.



Thanks for sharing that with me. I’m not setting any data layout, so it has to be the default one.

Neil, do you know the behavior you described is on LLVM 3.7?

So it look that the problem I have is somewhere else. That means I would need LLVM with debug symbols…