 -  return DoSearch(symbolName);
 -}
 -}  // namespace llvm
-Index: lib/Support/Unix/DynamicLibrary.inc
-===================================================================
---- lib/Support/Unix/DynamicLibrary.inc	(revision 0)
-+++ lib/Support/Unix/DynamicLibrary.inc	(revision 0)
-@@ -0,0 +1,74 @@
-+//===--- Unix/DynamicLibrary.cpp - Unix DL Implementation -------*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+//
-+// This file provides the dlsym specific implementation of DynamicLibrary.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#include <dlfcn.h>
-+
-+void *OpenLibraryImpl(const char *filename, std::string *errMsg) {
-+  void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);
-+  if (handle == 0) {
-+    if (errMsg) *errMsg = dlerror();
-+    return NULL;
-+  }
-+
-+#ifdef __CYGWIN__
-+  // Cygwin searches symbols only in the main
-+  // with the handle of dlopen(NULL, RTLD_GLOBAL).
-+  if (filename == NULL)
-+    handle = RTLD_DEFAULT;
-+#endif
-+  return handle;
-+}
-+
-+void CloseLibraryImpl(void *dlHandle) {
-+   dlclose(dlHandle);
-+}
-+
-+void *GetAddressOfSymbolImpl(void *dlHandle, const char *symbolName) {
-+  return dlsym(dlHandle, symbolName);
-+}
-+
-+#include <string.h>
-+
-+// Must declare the symbols in the global namespace.
-+void PopulateSpecialSymbolsImpl(StringMap<void *>& symMap) {
-+#define EXPLICIT_SYMBOL(SYM) \
-+   extern "C" void *SYM; symMap[#SYM] = &SYM
-+
-+  // If this is darwin, it has some funky issues, try to solve them here.  Some
-+  // important symbols are marked 'private external' which doesn't allow
-+  // SearchForAddressOfSymbol to find them.  As such, we special case them here,
-+  // there is only a small handful of them.
-+
-+#ifdef __APPLE__
-+  {
-+    // __eprintf is sometimes used for assert() handling on x86.
-+    //
-+    // FIXME: Currently disabled when using Clang, as we don't always have our
-+    // runtime support libraries available.
-+#ifndef __clang__
-+#ifdef __i386__
-+    EXPLICIT_SYMBOL(__eprintf);
-+#endif
-+#endif
-+  }
-+#endif
-+
-+#ifdef __CYGWIN__
-+  {
-+    EXPLICIT_SYMBOL(_alloca);
-+    EXPLICIT_SYMBOL(__main);
-+  }
-+#endif
-+
-+#undef EXPLICIT_SYMBOL
-+}
 Index: lib/Support/DynamicLibrary.cpp
 ===================================================================
 --- lib/Support/DynamicLibrary.cpp	(revision 167609)
 +++ lib/Support/DynamicLibrary.cpp	(working copy)
-@@ -14,29 +14,80 @@
+@@ -14,29 +14,52 @@
  //===----------------------------------------------------------------------===//
  
  #include "llvm/ADT/StringMap.h"

Index: lib/Support/SearchForAddressOfSpecialSymbol.cpp
===================================================================
--- lib/Support/SearchForAddressOfSpecialSymbol.cpp	(revision 167609)

+struct ExplicitSymbolHolder {
+  ExplicitSymbolHolder() {
+    PopulateSpecialSymbolsImpl(Map);
+  }
 
+  // Symbol name/value pairs to be searched prior to any libraries.
+  StringMap<void *> Map;
+};
