Skip to content

Commit 1ea3c7f

Browse files
ArturHarasimiukgfxbot
authored andcommitted
Use RTLD_DEEPBIND when loading other libraries
Change-Id: Ice5053a268c31257b37b0df7fa0b15d790b26997 Signed-off-by: Artur Harasimiuk <[email protected]>
1 parent 9244768 commit 1ea3c7f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

IGC/AdaptorOCL/cif/cif/os/lin/lin_library_handle.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ namespace CIF {
3131

3232
std::unique_ptr<LibraryHandle> OpenLibrary(const std::string &path, bool addOsSpecificExtensionToPath) {
3333
void *mod = nullptr;
34+
#ifdef SANITIZER_BUILD
35+
constexpr auto dlopenFlag = RTLD_LAZY;
36+
#else
37+
constexpr auto dlopenFlag = RTLD_LAZY | RTLD_DEEPBIND;
38+
#endif
39+
3440
if(addOsSpecificExtensionToPath){
35-
mod = dlopen((path + ".so").c_str(), RTLD_NOW);
41+
mod = dlopen((path + ".so").c_str(), dlopenFlag);
3642
}else{
37-
mod = dlopen(path.c_str(), RTLD_NOW);
43+
mod = dlopen(path.c_str(), dlopenFlag);
3844
}
3945
return OpenLibrary(UniquePtrLibrary(mod));
4046
}

IGC/common/ShaderOverride.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ void overrideShaderIGA(const IGC::CodeGenContext* context, void *& genxbin, int
199199
char igaName[] = "libiga32.so";
200200
#endif
201201

202+
#ifdef SANITIZER_BUILD
202203
hModule = dlopen(igaName, RTLD_LAZY);
204+
#else
205+
hModule = dlopen(igaName, RTLD_LAZY | RTLD_DEEPBIND);
206+
#endif
207+
203208
#endif
204209

205210
if (hModule == nullptr)

0 commit comments

Comments
 (0)