[llvm-dev] llvm 5.0 release rc1 : ExecutionEngine fatal error on MCJIT::getFunctionAddress

Christophe Duvernois via llvm-dev
Thu, 27 Jul 2017 13:38:40 -0000

Hi everyone,

In llvm 4.0 the MCJIT::getFunctionAddress function return 0 (a null
address) when the symbol is not found :








*uint64_t MCJIT::getSymbolAddress(const std::string &Name, bool
CheckFunctionsOnly) {  std::string MangledName;  {    raw_string_ostream
MangledNameStream(MangledName);
Mangler::getNameWithPrefix(MangledNameStream, Name, getDataLayout());  }
return findSymbol(MangledName, CheckFunctionsOnly).getAddress();}*

Now with the current implementation (llvm 5.0 rc1 tag) :


















*uint64_t MCJIT::getSymbolAddress(const std::string &Name, bool
CheckFunctionsOnly) {  std::string MangledName;  {    raw_string_ostream
MangledNameStream(MangledName);
Mangler::getNameWithPrefix(MangledNameStream, Name, getDataLayout());  }
if (auto Sym = findSymbol(MangledName, CheckFunctionsOnly)) {    if (auto
AddrOrErr = Sym.getAddress())      return *AddrOrErr;    else {
report_fatal_error(AddrOrErr.takeError());    }  } else {
report_fatal_error(Sym.takeError());  }}*
If the function findSymbol return nullptr, we are executing
report_fatal_error and kill everything :(

What is the reason for this change? Is this a bug?

If this is intended, how can we check from the ExecutionEngine that the
symbol already exists?


Regards,
Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20170727/e8838910/attachment.html>