 -  if (errMsg) *errMsg = "dlopen() not supported on this platform";
 -  return DynamicLibrary();
 +void* DynamicLibrary::getAddressOfSymbol(const char *symbolName) {
-+  return GetAddressOfSymbolImpl(Data, symbolName);
++  return GetAddressOfSymbolImpl(Data, symbolName, false /*Global*/);
  }
  
 -void *DynamicLibrary::getAddressOfSymbol(const char *symbolName) {

          E = OpenedHandles->end(); I != E; ++I) {
       //lt_ptr ptr = lt_dlsym(*I, symbolName);
-      void *ptr = dlsym(*I, symbolName);
+      void *ptr = GetAddressOfSymbolImpl(I->first, symbolName);
       if (ptr) {
         return ptr;
       }

 static llvm::sys::SmartMutex<true>& getMutex() {
   static llvm::sys::SmartMutex<true> HandlesMutex;
   return HandlesMutex;
@@ -46,144 +69,85 @@ void llvm::sys::DynamicLibrary::AddSymbol(StringRe
                                           void *symbolValue) {
   SmartScopedLock<true> lock(getMutex());
   if (ExplicitSymbols == 0)
