[compiler-rt] a6bdf3f - [asan][windows][tests] support MSVC compiler-id in asan tests (#109706)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 11:45:13 PDT 2024
Author: Charlie Barto
Date: 2024-09-24T11:45:10-07:00
New Revision: a6bdf3face377ee7ea84a02bada8a7e2ff380fe8
URL: https://github.com/llvm/llvm-project/commit/a6bdf3face377ee7ea84a02bada8a7e2ff380fe8
DIFF: https://github.com/llvm/llvm-project/commit/a6bdf3face377ee7ea84a02bada8a7e2ff380fe8.diff
LOG: [asan][windows][tests] support MSVC compiler-id in asan tests (#109706)
This follows up on https://github.com/llvm/llvm-project/pull/108255 to
allow actually running the test suite with MSVC. Note, however, that
MSVC can't yet build compiler-rt, most tests don't yet pass with msvc,
and building and testing with different compilers is ill-supported.
Follow ups will fix the first two issues, the third is future work.
Note that `/Zi` is removed from the clang-cl command line, but lit as a
whole adds `-gcodeview`, so there should still be debug info.
Added:
Modified:
compiler-rt/test/asan/lit.cfg.py
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py
index 05ed7e8dd294e3..dac3ef00a99af8 100644
--- a/compiler-rt/test/asan/lit.cfg.py
+++ b/compiler-rt/test/asan/lit.cfg.py
@@ -153,12 +153,16 @@ def build_invocation(compile_flags, with_lto=False):
if platform.system() == "Windows":
# MSVC-specific tests might also use the clang-cl.exe driver.
if target_is_msvc:
- clang_cl_cxxflags = [
- "-Wno-deprecated-declarations",
- "-WX",
- "-D_HAS_EXCEPTIONS=0",
- "-Zi",
- ] + target_cflags
+ clang_cl_cxxflags = (
+ [
+ "-WX",
+ "-D_HAS_EXCEPTIONS=0",
+ ]
+ + config.debug_info_flags
+ + target_cflags
+ )
+ if config.compiler_id != "MSVC":
+ clang_cl_cxxflags = ["-Wno-deprecated-declarations"] + clang_cl_cxxflags
clang_cl_asan_cxxflags = ["-fsanitize=address"] + clang_cl_cxxflags
if config.asan_dynamic:
clang_cl_asan_cxxflags.append("-MD")
@@ -286,6 +290,12 @@ def build_invocation(compile_flags, with_lto=False):
[config.compiler_rt_libdir, os.environ.get("PATH", "")]
)
+# msvc needs to be instructed where the compiler-rt libraries are
+if config.compiler_id == "MSVC":
+ config.environment["LIB"] = os.path.pathsep.join(
+ [config.compiler_rt_libdir, config.environment.get("LIB", "")]
+ )
+
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
More information about the llvm-commits
mailing list