Report library load errors in debug builds.

Change-Id: I24e63b15ad74fb86ecfe839f543800c2140c09d9
This commit is contained in:
Sean Keely
2017-11-22 19:27:32 -06:00
parent d2e70bb999
commit ca4c884306
3 changed files with 5 additions and 4 deletions
+1 -3
View File
@@ -53,7 +53,6 @@
#define __lseek__ _lseek
#else
#include <unistd.h>
#include <dlfcn.h>
#define __read__ read
#define __lseek__ lseek
#endif // _WIN32 || _WIN64
@@ -473,10 +472,9 @@ hsa_status_t hsa_system_get_major_extension_table(uint16_t extension, uint16_t v
os::LibHandle lib = os::LoadLib(kAqlProfileLib);
if (lib == NULL) {
fprintf(stderr, "Loading '%s' error: %s\n", kAqlProfileLib, dlerror());
debug_print("Loading '%s' failed\n", kAqlProfileLib);
return HSA_STATUS_ERROR;
}
dlerror(); // Clear any existing error
hsa_ven_amd_aqlprofile_1_00_pfn_t ext_table;
ext_table.hsa_ven_amd_aqlprofile_error_string =
@@ -67,6 +67,7 @@ static_assert(sizeof(Thread) == sizeof(pthread_t),
LibHandle LoadLib(std::string filename) {
void* ret = dlopen(filename.c_str(), RTLD_LAZY);
if (ret == nullptr) debug_print("LoadLib(%s) failed: %s\n", filename.c_str(), dlerror());
return *(LibHandle*)&ret;
}
+3 -1
View File
@@ -98,7 +98,9 @@ static __forceinline unsigned long long int strtoull(const char* str,
#define PASTE(x, y) PASTE2(x, y)
#ifdef NDEBUG
#define debug_warning(exp)
#define debug_warning(exp) \
do { \
} while (false)
#else
#define debug_warning(exp) \
do { \