Skip to content

Commit b8ce6a2

Browse files
authored
logging full path of loaded adapter (#2335)
1 parent 7d0cc6d commit b8ce6a2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

source/common/linux/ur_lib_loader.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
*
99
*/
1010
#include <dlfcn.h>
11+
#if __has_include(<link.h>)
12+
#include <link.h>
13+
#define ADD_FULL_PATH_LOG
14+
#endif
1115

1216
#include "logger/ur_logger.hpp"
1317
#include "ur_lib_loader.hpp"
@@ -50,7 +54,14 @@ LibLoader::loadAdapterLibrary(const char *name) {
5054
logger::info("failed to load adapter '{}' with error: {}", name,
5155
err ? err : "unknown error");
5256
} else {
53-
logger::info("loaded adapter 0x{} ({})", handle, name);
57+
#if defined(ADD_FULL_PATH_LOG)
58+
struct link_map *dlinfo_map;
59+
if (dlinfo(handle, RTLD_DI_LINKMAP, &dlinfo_map) == 0) {
60+
logger::info("loaded adapter 0x{} ({}) from {}", handle, name,
61+
dlinfo_map->l_name);
62+
} else
63+
#endif
64+
logger::info("loaded adapter 0x{} ({})", handle, name);
5465
}
5566
return std::unique_ptr<HMODULE, LibLoader::lib_dtor>(handle);
5667
}

0 commit comments

Comments
 (0)