[llvm-commits] [Patch Proposal] Cygwin's dlsym(3) could not find preloaded symbols

NAKAMURA Takumi geek4civic at gmail.com
Mon Aug 16 20:44:50 PDT 2010


Good afternoon,

Cygwin's dlsym(3) searches symbols only in the main module
when the handle dlopen(NULL, RTLD_GLOBAL) is given.

It causes failure of ENABLE_SHARED=1
unittests/ExecutionEngine/JIT/MultiJITTest.cpp.

Feel free to rewrite my comment in this patch.


...Takumi
-------------- next part --------------
diff --git a/lib/System/DynamicLibrary.cpp b/lib/System/DynamicLibrary.cpp
index 6f6890c..660db49 100644
--- a/lib/System/DynamicLibrary.cpp
+++ b/lib/System/DynamicLibrary.cpp
@@ -70,6 +70,12 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *Filename,
     if (ErrMsg) *ErrMsg = dlerror();
     return true;
   }
+#ifdef __CYGWIN__
+  // Cygwin searches symbols only in the main
+  // with the handle of dlopen(NULL, RTLD_GLOBAL).
+  if (Filename == NULL)
+    H = RTLD_DEFAULT;
+#endif
   if (OpenedHandles == 0)
     OpenedHandles = new std::vector<void *>();
   OpenedHandles->push_back(H);


More information about the llvm-commits mailing list