Browse code

Disable dlopen in LLVM, we don't use it.

Török Edvin authored on 2009/12/16 22:07:39
Showing 3 changed files
... ...
@@ -423,8 +423,9 @@ EngineBuilder::EngineBuilder(Module *m) : MP(new ExistingModuleProvider(m)) {
423 423
 ExecutionEngine *EngineBuilder::create() {
424 424
   // Make sure we can resolve symbols in the program as well. The zero arg
425 425
   // to the function tells DynamicLibrary to load the program, not a library.
426
-  if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
427
-    return 0;
426
+/* CLAMAV LOCAL: allow for no dlopen */
427
+//  if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
428
+//    return 0;
428 429
 
429 430
   // If the user specified a memory manager but didn't specify which engine to
430 431
   // create, we assume they only want the JIT, and we fail if they only want
... ...
@@ -211,8 +211,9 @@ ExecutionEngine *JIT::createJIT(ModuleProvider *MP,
211 211
                                 CodeModel::Model CMM) {
212 212
   // Make sure we can resolve symbols in the program as well. The zero arg
213 213
   // to the function tells DynamicLibrary to load the program, not a library.
214
-  if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
215
-    return 0;
214
+/* CLAMAV LOCAL: no dlopen */
215
+//  if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
216
+//   return 0;
216 217
 
217 218
   // Pick a target either via -march or by guessing the native arch.
218 219
   TargetMachine *TM = JIT::selectTarget(MP, ErrorStr);
... ...
@@ -44,6 +44,17 @@ void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName,
44 44
 
45 45
 #else
46 46
 
47
+#if 1
48
+/* CLAMAV LOCAL: no plugins */
49
+bool llvm::sys::DynamicLibrary::LoadLibraryPermanently(const char *Filename,
50
+                                            std::string *ErrMsg) {
51
+    if (ErrMsg) *ErrMsg = "dlopen disabled";
52
+    return true;
53
+}
54
+void* llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
55
+    return 0;
56
+}
57
+#else
47 58
 #include <dlfcn.h>
48 59
 using namespace llvm;
49 60
 using namespace llvm::sys;
... ...
@@ -55,7 +66,6 @@ using namespace llvm::sys;
55 55
 
56 56
 static std::vector<void *> *OpenedHandles = 0;
57 57
 
58
-
59 58
 bool DynamicLibrary::LoadLibraryPermanently(const char *Filename,
60 59
                                             std::string *ErrMsg) {
61 60
   void *H = dlopen(Filename, RTLD_LAZY|RTLD_GLOBAL);
... ...
@@ -161,5 +171,5 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
161 161
 
162 162
   return 0;
163 163
 }
164
-
165 164
 #endif // LLVM_ON_WIN32
165
+#endif