From 0b337a2483f36a9daca6474f6c6368da84780b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Wed, 16 Dec 2009 15:07:39 +0200 Subject: [PATCH] Disable dlopen in LLVM, we don't use it. --- .../llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 5 +++-- libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp | 5 +++-- libclamav/c++/llvm/lib/System/DynamicLibrary.cpp | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index cb307483f..e82364711 100644 --- a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -423,8 +423,9 @@ EngineBuilder::EngineBuilder(Module *m) : MP(new ExistingModuleProvider(m)) { ExecutionEngine *EngineBuilder::create() { // Make sure we can resolve symbols in the program as well. The zero arg // to the function tells DynamicLibrary to load the program, not a library. - if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)) - return 0; +/* CLAMAV LOCAL: allow for no dlopen */ +// if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)) +// return 0; // If the user specified a memory manager but didn't specify which engine to // create, we assume they only want the JIT, and we fail if they only want diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp index 26afa548a..52cac86a4 100644 --- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp @@ -211,8 +211,9 @@ ExecutionEngine *JIT::createJIT(ModuleProvider *MP, CodeModel::Model CMM) { // Make sure we can resolve symbols in the program as well. The zero arg // to the function tells DynamicLibrary to load the program, not a library. - if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)) - return 0; +/* CLAMAV LOCAL: no dlopen */ +// if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)) +// return 0; // Pick a target either via -march or by guessing the native arch. TargetMachine *TM = JIT::selectTarget(MP, ErrorStr); diff --git a/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp b/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp index 7eb9f5f3e..f658aea90 100644 --- a/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp +++ b/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp @@ -44,6 +44,17 @@ void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, #else +#if 1 +/* CLAMAV LOCAL: no plugins */ +bool llvm::sys::DynamicLibrary::LoadLibraryPermanently(const char *Filename, + std::string *ErrMsg) { + if (ErrMsg) *ErrMsg = "dlopen disabled"; + return true; +} +void* llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { + return 0; +} +#else #include using namespace llvm; using namespace llvm::sys; @@ -55,7 +66,6 @@ using namespace llvm::sys; static std::vector *OpenedHandles = 0; - bool DynamicLibrary::LoadLibraryPermanently(const char *Filename, std::string *ErrMsg) { void *H = dlopen(Filename, RTLD_LAZY|RTLD_GLOBAL); @@ -161,5 +171,5 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { return 0; } - #endif // LLVM_ON_WIN32 +#endif