clang-interpreter on windows


We have been using a JIT clang modelled after clang-interpreter from version 5.0.0.
It has been working on linux, osx and windows (x86 and x64).

Recently I attempted to upgrade llvm and clang to 7 and then 8, currently trying

llvm and cfe 8.0.1.
There are significant changes in using the newer JIT system and I see that there is another iteration coming in the trunk.

The clang-interpreter example works on mac but on windows I can’t get it to work.
I have built x86 /MD, x64 /MD and an x86 /MT version, all with Visual Studio 2017, Version 15.8.8.

Initially for me the debug version asserts with the following message and the release version crashes as it fails to resolve the pointer to main.

Assertion failed: Target.isCompatibleDataLayout(getDataLayout()) && "Can’t create a MachineFunction using a Module with a " “Target-incompatible DataLayout attached\n”, file d:\bl\llvm\llvm-8.0.1.src\lib\codegen\machinefunction.cpp, line 200

I inferred that the JIT container and the compiled module are incompatible. I think this is because the code explicitly changes the detected Triple from COFF to ELF.
// Use ELF on Windows-32 and MingW for now.
if (T.isOSBinFormatCOFF())

I wondered if maybe this is no longer necessary so tried commenting it out, which resolved the error assertion but now the debug version also just silently fails to find the symbol.

This is the output from dumping the module, the input C++ I have simplified from the provided example Test.cxx by removing the exception throw and hard coded a printf(“hello\n”);