Index: compiler-rt/test/dfsan/libatomic.c =================================================================== --- compiler-rt/test/dfsan/libatomic.c +++ compiler-rt/test/dfsan/libatomic.c @@ -1,7 +1,7 @@ -// RUN: %clang_dfsan -g3 -DDATA_BYTES=3 %s -fno-exceptions -latomic -o %t && %run %t -// RUN: %clang_dfsan -g3 -DDATA_BYTES=3 -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -latomic -o %t && %run %t -// RUN: %clang_dfsan -g3 -DDATA_BYTES=32 %s -fno-exceptions -latomic -o %t && %run %t -// RUN: %clang_dfsan -g3 -DDATA_BYTES=32 -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -latomic -o %t && %run %t +// RUN: %clang_dfsan -g3 -DDATA_BYTES=3 %s -fno-exceptions %libatomic -o %t && %run %t +// RUN: %clang_dfsan -g3 -DDATA_BYTES=3 -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions %libatomic -o %t && %run %t +// RUN: %clang_dfsan -g3 -DDATA_BYTES=32 %s -fno-exceptions %libatomic -o %t && %run %t +// RUN: %clang_dfsan -g3 -DDATA_BYTES=32 -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions %libatomic -o %t && %run %t #include #include Index: compiler-rt/test/lit.common.cfg.py =================================================================== --- compiler-rt/test/lit.common.cfg.py +++ compiler-rt/test/lit.common.cfg.py @@ -877,3 +877,13 @@ # related is likely to cause issues with sanitizer tests, because it may # preempt something we're looking to trap (e.g. _FORTIFY_SOURCE vs our ASAN). config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1" + +if config.has_compiler_rt_libatomic: + base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.atomic%s.so" + % config.target_suffix) + if sys.platform in ['win32'] and execute_external: + # Don't pass dosish path separator to msys bash.exe. + base_lib = base_lib.replace('\\', '/') + config.substitutions.append(("%libatomic", base_lib + f" -Wl,-rpath,{config.compiler_rt_libdir}")) +else: + config.substitutions.append(("%libatomic", "-latomic")) Index: compiler-rt/test/msan/libatomic.c =================================================================== --- compiler-rt/test/msan/libatomic.c +++ compiler-rt/test/msan/libatomic.c @@ -1,6 +1,6 @@ -// RUN: %clang_msan -fsanitize-memory-track-origins=2 -latomic -DTEST_STORE -O0 %s -o %t && %run %t 2>&1 -// RUN: %clang_msan -fsanitize-memory-track-origins=0 -latomic -DTEST_LOAD -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK -// RUN: %clang_msan -fsanitize-memory-track-origins=2 -latomic -DTEST_LOAD -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SHADOW +// RUN: %clang_msan -fsanitize-memory-track-origins=2 %libatomic -DTEST_STORE -O0 %s -o %t && %run %t 2>&1 +// RUN: %clang_msan -fsanitize-memory-track-origins=0 %libatomic -DTEST_LOAD -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK +// RUN: %clang_msan -fsanitize-memory-track-origins=2 %libatomic -DTEST_LOAD -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SHADOW // PPC has no libatomic // UNSUPPORTED: powerpc64-target-arch Index: compiler-rt/test/msan/libatomic_load_exceptions.cpp =================================================================== --- compiler-rt/test/msan/libatomic_load_exceptions.cpp +++ compiler-rt/test/msan/libatomic_load_exceptions.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx_msan -fexceptions -fsanitize-memory-track-origins=2 -latomic -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SHADOW +// RUN: %clangxx_msan -fexceptions -fsanitize-memory-track-origins=2 %libatomic -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SHADOW // PPC has no libatomic // UNSUPPORTED: powerpc64-target-arch