diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/slang-platform.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index 4f9b0698c..9185559a2 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -173,13 +173,24 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); /* static */SlangResult SharedLibrary::loadWithPlatformPath(char const* platformFileName, Handle& handleOut) { handleOut = nullptr; - const auto dxcName = "libdxcompiler"; - const bool isDXC = strncmp(platformFileName, dxcName, strlen(dxcName)) == 0; + // Work around + // https://github.com/microsoft/DirectXShaderCompiler/issues/5119 and + // https://github.com/doitsujin/dxvk/issues/3330 + // libdxcompiler.so invokes UB on dlclose, the dxvk libs break GDB when + // closed + const auto unclosableLibNames = {"libdxcompiler", "libdxvk_d3d11", "libdxvk_dxgi"}; + bool isUnclosable = false; + for(auto n : unclosableLibNames) + { + if(strncmp(platformFileName, n, strlen(n)) == 0) + { + isUnclosable = true; + break; + } + } if (strlen(platformFileName) == 0) platformFileName = nullptr; - // Work around https://github.com/microsoft/DirectXShaderCompiler/issues/5119 - // libdxcompiler.so invokes UB on dlclose - const auto mode = RTLD_NOW | RTLD_GLOBAL | (isDXC ? RTLD_NODELETE : 0); + const auto mode = RTLD_NOW | RTLD_GLOBAL | (isUnclosable ? RTLD_NODELETE : 0); void *h = dlopen(platformFileName, mode); if (!h) { |
