Fixing MCJIT multiple module linking for OSX
authorAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 1 Oct 2013 16:42:50 +0000 (16:42 +0000)
committerAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 1 Oct 2013 16:42:50 +0000 (16:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191780 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/MCJIT/MCJIT.cpp

index 9eaff4d68a2c8cb0aca7ce47eae2260b4d238c22..09fc75c6ae0ec4f7a1d2d84c780c74c9f614049f 100644 (file)
@@ -526,6 +526,10 @@ void MCJIT::NotifyFreeingObject(const ObjectImage& Obj) {
 
 uint64_t LinkingMemoryManager::getSymbolAddress(const std::string &Name) {
   uint64_t Result = ParentEngine->getSymbolAddress(Name, false);
+  // If the symbols wasn't found and it begins with an underscore, try again
+  // without the underscore.
+  if (!Result && Name[0] == '_')
+    Result = ParentEngine->getSymbolAddress(Name.substr(1), false);
   if (Result)
     return Result;
   return ClientMM->getSymbolAddress(Name);