 -  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) {

+// Close the shared library.
+static void  CloseLibraryImpl(void *dlHandle);
+// Get the address of the symbol named symname from the library with dlhandle.
+static void *GetAddressOfSymbolImpl(void *dlHandle, const char *symbolName);
+// Inject special platform symbols into the map of explicitly defined symbols.
+static void PopulateSpecialSymbolsImpl(StringMap<void *>& symMap);
+

 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)
