X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FDynamicLibrary.cpp;h=45fec361c1a6cf26b1768f10032c025fbfe62be4;hb=b21d9aebba7e45ddcbce61dd501000049cefb335;hp=63298b99a0c987c1fb6f1bad31cb8aadbb7a03fb;hpb=0bce85fbfacec97255337d12fc0ab193f03f21c3;p=oota-llvm.git diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp index 63298b99a0c..45fec361c1a 100644 --- a/lib/Support/DynamicLibrary.cpp +++ b/lib/Support/DynamicLibrary.cpp @@ -50,6 +50,8 @@ void llvm::sys::DynamicLibrary::AddSymbol(StringRef symbolName, (*ExplicitSymbols)[symbolName] = symbolValue; } +char llvm::sys::DynamicLibrary::Invalid = 0; + #ifdef LLVM_ON_WIN32 #include "Windows/DynamicLibrary.inc" @@ -70,6 +72,8 @@ static DenseSet *OpenedHandles = 0; DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename, std::string *errMsg) { + SmartScopedLock lock(getMutex()); + void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL); if (handle == 0) { if (errMsg) *errMsg = dlerror(); @@ -83,7 +87,6 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename, handle = RTLD_DEFAULT; #endif - SmartScopedLock lock(getMutex()); if (OpenedHandles == 0) OpenedHandles = new DenseSet(); @@ -157,7 +160,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { // On linux we have a weird situation. The stderr/out/in symbols are both // macros and global variables because of standards requirements. So, we // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. -#if defined(__linux__) +#if defined(__linux__) and !defined(__ANDROID__) { EXPLICIT_SYMBOL(stderr); EXPLICIT_SYMBOL(stdout);