Fixes hang due to change in order of initialization of libraries

Fixes hang due to change in order of initialization of libraries
that have cyclical dependencies and they call hsa_init() during their
initialization phase.
This implementation looks for a symbol called "HSA_AMD_TOOL_PRIORITY"
across all loaded shared libraries using dynamic section entries of the
loaded lib instead of using dlopen and dlsym for the same purpose.

Change-Id: I4865f2fd18dd186ec311a432ec38fbb5583805d2
This commit is contained in:
Shweta Khatri
2023-01-19 17:58:41 -05:00
parent e30be76f37
commit 8aac885318
3 changed files with 84 additions and 7 deletions
+1 -1
View File
@@ -1542,7 +1542,7 @@ void Runtime::LoadTools() {
}
// Discover loaded tools.
std::vector<os::LibHandle> loaded = os::GetLoadedLibs();
std::vector<os::LibHandle> loaded = os::GetLoadedToolsLib();
for(auto& handle : loaded) {
const uint32_t* order = (const uint32_t*)os::GetExportAddress(handle, "HSA_AMD_TOOL_PRIORITY");
if(order) {