diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake index 9a9754684a8..3827a9b3e11 100644 --- a/cmake/LLVM.cmake +++ b/cmake/LLVM.cmake @@ -91,12 +91,6 @@ function(fetch_or_build_slang_llvm) target_compile_options(slang-llvm PRIVATE -wd4244 /Zc:preprocessor) endif() - if(NOT LLVM_ENABLE_RTTI) - # Make sure that we don't disable rtti if this library wasn't compiled with - # support - add_supported_cxx_flags(slang-llvm PRIVATE -fno-rtti /GR-) - endif() - # TODO: Put a check here that libslang-llvm.so doesn't have a 'NEEDED' # directive for libLLVM-21.so, it's almost certainly going to break at # runtime in surprising ways when linked alongside Mesa (or anything else diff --git a/external/build-llvm.sh b/external/build-llvm.sh index 91bc56560a7..571f00ae2b1 100755 --- a/external/build-llvm.sh +++ b/external/build-llvm.sh @@ -134,6 +134,9 @@ cmake_arguments_for_slang=( -DLLVM_ENABLE_PROJECTS=clang "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64" -DLLVM_BUILD_TOOLS=0 + # slang-llvm is built with RTTI enabled to support UndefinedBehaviorSanitizer's vptr checks, so + # LLVM should be built with RTTI as well + -DLLVM_ENABLE_RTTI=1 # Get LLVM to use the static linked version of the msvc runtime "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>" "-DLLVM_USE_CRT_RELEASE=MT"