diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-platform.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index dc2d563df..bb612932c 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -177,9 +177,14 @@ 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; if (strlen(platformFileName) == 0) platformFileName = nullptr; - void *h = dlopen(platformFileName, RTLD_NOW | RTLD_GLOBAL); + // 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); + void *h = dlopen(platformFileName, mode); if (!h) { #if 0 |
