[WebAssembly] Use an immediate OperandType for offset operands.
[oota-llvm.git] / lib / Support / DynamicLibrary.cpp
index 40072636608de494c44273b823b196f9b5e0c3cc..9a7aeb50a216c48d3f131b52c71c87d87e32ac10 100644 (file)
@@ -56,15 +56,8 @@ static DenseSet<void *> *OpenedHandles = nullptr;
 DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
                                                    std::string *errMsg) {
   SmartScopedLock<true> lock(*SymbolsMutex);
-  int flags = RTLD_LAZY | RTLD_GLOBAL;
-#if defined(__APPLE__)
-  // RTLD_FIRST is an apple specific flag which causes dlsym() to search only
-  // the module specified in |filename|, and not dependent modules.  This
-  // behavior would be desirable for other platforms as well, except that
-  // there's not a good way to implement it.
-  flags |= RTLD_FIRST;
-#endif
-  void *handle = dlopen(filename, flags);
+
+  void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);
   if (!handle) {
     if (errMsg) *errMsg = dlerror();
     return DynamicLibrary();
@@ -185,3 +178,12 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
 LLVMBool LLVMLoadLibraryPermanently(const char* Filename) {
   return llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename);
 }
+
+void *LLVMSearchForAddressOfSymbol(const char *symbolName) {
+  return llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(symbolName);
+}
+
+void LLVMAddSymbol(const char *symbolName, void *symbolValue) {
+  return llvm::sys::DynamicLibrary::AddSymbol(symbolName, symbolValue);
+}
+