diff options
author | Andrea Mattavelli <andreamattavelli@users.noreply.github.com> | 2016-09-16 10:04:27 +0100 |
---|---|---|
committer | Dan Liew <delcypher@gmail.com> | 2016-09-16 10:04:27 +0100 |
commit | 1bfdbc61f2e14d8b0f2b5ca45ca8266c363cbfc5 (patch) | |
tree | a98b88133d260c70c336f51ff09e727c79ca69dc /lib/Module | |
parent | 9baab03a58ffb8c74a2c3db40256521050f68049 (diff) | |
download | klee-1bfdbc61f2e14d8b0f2b5ca45ca8266c363cbfc5.tar.gz |
Avoid internalization of non-standard entry point (i.e. not the main function) (#455)
Diffstat (limited to 'lib/Module')
-rw-r--r-- | lib/Module/KModule.cpp | 4 | ||||
-rw-r--r-- | lib/Module/Optimize.cpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 01165e94..57346a31 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -132,7 +132,7 @@ KModule::~KModule() { /***/ namespace llvm { -extern void Optimize(Module*); +extern void Optimize(Module *, const std::string &EntryPoint); } // what a hack @@ -308,7 +308,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, pm.run(*module); if (opts.Optimize) - Optimize(module); + Optimize(module, opts.EntryPoint); #if LLVM_VERSION_CODE < LLVM_VERSION(3, 3) // Force importing functions required by intrinsic lowering. Kind of // unfortunate clutter when we don't need them but we won't know diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index ce43cd96..3d9c8cc1 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -163,7 +163,7 @@ static void AddStandardCompilePasses(PassManager &PM) { /// Optimize - Perform link time optimizations. This will run the scalar /// optimizations, any loaded plugin-optimization modules, and then the /// inter-procedural optimizations if applicable. -void Optimize(Module* M) { +void Optimize(Module *M, const std::string &EntryPoint) { // Instantiate the pass manager to organize the passes. PassManager Passes; @@ -192,7 +192,8 @@ void Optimize(Module* M) { // internal. if (!DisableInternalize) { #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2) - ModulePass *pass = createInternalizePass(std::vector<const char *>(1, "main")); + ModulePass *pass = createInternalizePass( + std::vector<const char *>(1, EntryPoint.c_str())); #else ModulePass *pass = createInternalizePass(true); #endif |