about summary refs log tree commit diff homepage
path: root/lib/Core
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-02-28 18:06:33 +0100
committerJiri Slaby <jirislaby@gmail.com>2017-02-28 20:45:45 +0100
commitf89cdd04911e4acc9c045f2de6d1f50acec8e271 (patch)
tree39681c8d8e9bdfcd876ae775fc31b3b8ddda9c19 /lib/Core
parente21bf6f653b9c602fe21b74ff7c389aa2430b386 (diff)
downloadklee-f89cdd04911e4acc9c045f2de6d1f50acec8e271.tar.gz
Core: MCJIT functions need unique names
We will use newer MCJIT with newer LLVM versions. But it needs unique
names of functions or a wrong function can be called.  So prepend
"dispatcher_" to function names (even for older LLVMs).

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Core')
-rw-r--r--lib/Core/ExternalDispatcher.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 01c5f935..984e3ab2 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -207,10 +207,11 @@ Function *ExternalDispatcher::createDispatcher(Function *target, Instruction *in
 
   std::vector<LLVM_TYPE_Q Type*> nullary;
   
+  // MCJIT functions need unique names, or wrong function can be called
   Function *dispatcher = Function::Create(FunctionType::get(Type::getVoidTy(ctx),
 							    nullary, false),
 					  GlobalVariable::ExternalLinkage, 
-					  "",
+					  "dispatcher_" + target->getName().str(),
 					  dispatchModule);