diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-01-29 15:24:46 +0000 |
---|---|---|
committer | Martin Nowack <martin@se.inf.tu-dresden.de> | 2014-02-06 23:55:29 +0100 |
commit | d3202c9705ebd840051574956c04d12322c8afe6 (patch) | |
tree | e75f1a0b97a5b5ed176a2406a9e98a8a54dae5fc | |
parent | 2bddb27b38b4aebee7977afb8de4f5c849384750 (diff) | |
download | klee-d3202c9705ebd840051574956c04d12322c8afe6.tar.gz |
Do not consider llvm intrinsics as undefined symbols in KLEE's
bitcode archive linker.
-rw-r--r-- | lib/Module/ModuleUtil.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index ef2752ed..1881c817 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -70,6 +70,7 @@ using namespace klee; /// static void GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) { + static const std::string llvmIntrinsicPrefix="llvm."; std::set<std::string> DefinedSymbols; UndefinedSymbols.clear(); DEBUG_WITH_TYPE("klee_linker", dbgs() << "*** Computing undefined symbols ***\n"); @@ -102,18 +103,33 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) { if (I->hasName()) DefinedSymbols.insert(I->getName()); - // Prune out any defined symbols from the undefined symbols set... + // Prune out any defined symbols from the undefined symbols set + // and other symbols we don't want to treat as an undefined symbol for (std::set<std::string>::iterator I = UndefinedSymbols.begin(); I != UndefinedSymbols.end(); ) + { if (DefinedSymbols.count(*I)) + { UndefinedSymbols.erase(I++); // This symbol really is defined! - else + continue; + } + + // Strip out llvm intrinsics + if ( (I->size() >= llvmIntrinsicPrefix.size() ) && + (I->compare(0, llvmIntrinsicPrefix.size(), llvmIntrinsicPrefix) == 0) ) { - DEBUG_WITH_TYPE("klee_linker", dbgs() << "Symbol " << *I << " is undefined.\n"); - ++I; // Keep this symbol in the undefined symbols list + DEBUG_WITH_TYPE("klee_linker", dbgs() << "LLVM intrinsic " << *I << + " has been removed from undefined symbols"<< "\n"); + UndefinedSymbols.erase(I++); + continue; } - // FIXME: Remove KLEE special functions and LLVM intrinsics + // Symbol really is undefined + DEBUG_WITH_TYPE("klee_linker", dbgs() << "Symbol " << *I << " is undefined.\n"); + ++I; // Keep this symbol in the undefined symbols list + } + + // FIXME: Remove KLEE special functions // from the list of undefined symbols. HandlerInfo in SpecialFunctionHandler // needs to be moved so we can use it here. |