LLVM 9.0.0 ORC JIT on windows, Duplicate definition of symbol '__real@

I’ve been using ORC jit based off the Kaleidoscope tutorials successfully on Linux and OS X. However when I tried to move to windows I’m having troubles.

Following the advice here, http://lists.llvm.org/pipermail/llvm-dev/2019-January/128812.html, I added:
ObjectLayer.setAutoClaimResponsibilityForObjectSymbols( true );

ObjectLayer.setOverrideObjectFlagsWithResponsibilityFlags( true );

I’m JITTing multiple functions in a loop.
I create the Module and lookup the first function just fine using the following code from the tutorial.

llvm::cantFail( jit->addModule(std::move(mModule)));

auto ExprSymbol = jit->lookup( func_name.c_str( ));

When I go to lookup the second function I’m jitting, I get the following error:

JIT session error: Duplicate definition of symbol ‘__real@3ff0000000000000’

Any pointers or help would be appreciated,


Hi Kevin,

Sounds like you have run into this bug: https://bugs.llvm.org/show_bug.cgi?id=40074

A workaround is to build LLVM with HasCOFFComdatConstants set to false in MCAsmInfoCOFF.cpp.


Machiel van Hooren