loader: Revert ICD dlopen back to using RTLD_LAZY
authorLenny Komow <lenny@lunarg.com>
Thu, 18 May 2017 20:02:26 +0000 (14:02 -0600)
committerLenny Komow <lenny@lunarg.com>
Thu, 18 May 2017 21:04:31 +0000 (15:04 -0600)
Change-Id: I53ae66929ed38d81eb52cc0307341d5c8f97cdc8

loader/vk_loader_platform.h

index 4065653..c1ae0d8 100644 (file)
@@ -98,10 +98,11 @@ static inline char *loader_platform_dirname(char *path) { return dirname(path);
 // Dynamic Loading of libraries:
 typedef void *loader_platform_dl_handle;
 static inline loader_platform_dl_handle loader_platform_open_library(const char *libPath) {
-    // When loading the library, we need to make sure we load it with RTLD_NOW to force
-    // symbol resolution at the time of load.  This way, we make sure that all appropriate
-    // symbols are there.
-    return dlopen(libPath, RTLD_NOW | RTLD_LOCAL);
+    // When loading the library, we use RTLD_LAZY so that not all symbols have to be
+    // resolved at this time (which improves performance). Note that if not all symbols
+    // can be resolved, this could cause crashes later. Use the LD_BIND_NOW environment
+    // variable to force all symbols to be resolved here.
+    return dlopen(libPath, RTLD_LAZY | RTLD_LOCAL);
 }
 static inline const char *loader_platform_open_library_error(const char *libPath) { return dlerror(); }
 static inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); }