summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-28 08:59:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-28 08:59:52 +0000
commit60f6083a36efa80a940a6de70138925bdaabdda0 (patch)
tree600e97be2a8aecb6fd2a3f5d215ef937c20c03ce /lib/ExecutionEngine
parent680cd7b07707407ff29083b2fcad97c076213b8c (diff)
downloadllvm-60f6083a36efa80a940a6de70138925bdaabdda0.tar.gz
llvm-60f6083a36efa80a940a6de70138925bdaabdda0.tar.bz2
llvm-60f6083a36efa80a940a6de70138925bdaabdda0.tar.xz
Use the mangler consistently instead of using getGlobalPrefix directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/MCJIT/MCJIT.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 195c45850c..5841d918de 100644
--- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -25,6 +25,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MutexGuard.h"
+#include "llvm/Target/Mangler.h"
using namespace llvm;
@@ -231,11 +232,10 @@ void *MCJIT::getPointerToBasicBlock(BasicBlock *BB) {
}
uint64_t MCJIT::getExistingSymbolAddress(const std::string &Name) {
- // Check with the RuntimeDyld to see if we already have this symbol.
- if (Name[0] == '\1')
- return Dyld.getSymbolLoadAddress(Name.substr(1));
- return Dyld.getSymbolLoadAddress((TM->getMCAsmInfo()->getGlobalPrefix()
- + Name));
+ Mangler Mang(TM);
+ SmallString<128> FullName;
+ Mang.getNameWithPrefix(FullName, Name);
+ return Dyld.getSymbolLoadAddress(FullName);
}
Module *MCJIT::findModuleForSymbol(const std::string &Name,
@@ -320,15 +320,13 @@ void *MCJIT::getPointerToFunction(Function *F) {
return NULL;
// FIXME: Should the Dyld be retaining module information? Probably not.
- // FIXME: Should we be using the mangler for this? Probably.
//
// This is the accessor for the target address, so make sure to check the
// load address of the symbol, not the local address.
- StringRef BaseName = F->getName();
- if (BaseName[0] == '\1')
- return (void*)Dyld.getSymbolLoadAddress(BaseName.substr(1));
- return (void*)Dyld.getSymbolLoadAddress((TM->getMCAsmInfo()->getGlobalPrefix()
- + BaseName).str());
+ Mangler Mang(TM);
+ SmallString<128> Name;
+ Mang.getNameWithPrefix(Name, F, false);
+ return (void*)Dyld.getSymbolLoadAddress(Name);
}
void *MCJIT::recompileAndRelinkFunction(Function *F) {