[compiler-rt] 6f9297f - [compiler-rt] Fix build race with COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 15:22:09 PDT 2024
Author: Alexander Richardson
Date: 2024-03-21T15:22:06-07:00
New Revision: 6f9297fc4da9df776aef7ee9a18ac426053aaed4
URL: https://github.com/llvm/llvm-project/commit/6f9297fc4da9df776aef7ee9a18ac426053aaed4
DIFF: https://github.com/llvm/llvm-project/commit/6f9297fc4da9df776aef7ee9a18ac426053aaed4.diff
LOG: [compiler-rt] Fix build race with COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
Since this standalone build configuration uses the runtime libraries that
are being built just now, we need to ensure that e.g. the TSan unit tests
depend on the tsan runtime library. Also fix TSAN_DEPS being overridden
to not include the tsan runtime (commit .....).
This change fixes a build race seen in the CI checks for
TsanRtlTest-x86_64-Test in https://github.com/llvm/llvm-project/pull/83088.
Reviewed By: vitalybuka
Pull Request: https://github.com/llvm/llvm-project/pull/83650
Added:
Modified:
compiler-rt/cmake/Modules/CompilerRTCompile.cmake
compiler-rt/lib/msan/tests/CMakeLists.txt
compiler-rt/lib/tsan/tests/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
index d5b2e7970f11cc2..1629db18f1c2d98 100644
--- a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
@@ -46,7 +46,7 @@ function(sanitizer_test_compile obj_list source arch)
# Write out architecture-specific flags into TARGET_CFLAGS variable.
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
set(COMPILE_DEPS ${TEST_COMPILE_DEPS})
- if(NOT COMPILER_RT_STANDALONE_BUILD)
+ if(NOT COMPILER_RT_STANDALONE_BUILD OR COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
list(APPEND COMPILE_DEPS ${TEST_DEPS})
endif()
clang_compile(${output_obj} ${source}
diff --git a/compiler-rt/lib/msan/tests/CMakeLists.txt b/compiler-rt/lib/msan/tests/CMakeLists.txt
index 4f09f1e6a691fac..e0771dd5a1a7e19 100644
--- a/compiler-rt/lib/msan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/msan/tests/CMakeLists.txt
@@ -69,9 +69,9 @@ macro(msan_compile obj_list source arch kind cflags)
sanitizer_test_compile(
${obj_list} ${source} ${arch}
KIND ${kind}
- COMPILE_DEPS ${MSAN_UNITTEST_HEADERS}
+ COMPILE_DEPS ${MSAN_UNITTEST_HEADERS} libcxx_msan_${arch}-build
DEPS msan
- CFLAGS -isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1
+ CFLAGS -isystem ${MSAN_LIBCXX_DIR}/../include/c++/v1
${MSAN_UNITTEST_INSTRUMENTED_CFLAGS} ${cflags}
)
endmacro()
@@ -120,7 +120,7 @@ macro(add_msan_tests_for_arch arch kind cflags)
set(MSAN_TEST_DEPS ${MSAN_TEST_OBJECTS} libcxx_msan_${arch}-build
${MSAN_LOADABLE_SO}
"${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a")
- list(APPEND MSAN_TEST_DEPS msan)
+ list(APPEND MSAN_TEST_DEPS msan libcxx_msan_${arch}-build)
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
add_compiler_rt_test(MsanUnitTests "Msan-${arch}${kind}-Test" ${arch}
OBJECTS ${MSAN_TEST_OBJECTS} "${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a"
diff --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt
index ad8cc9b0eb05af9..1bc08bbf7450c81 100644
--- a/compiler-rt/lib/tsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt
@@ -67,7 +67,7 @@ endforeach()
set(TSAN_DEPS tsan)
# TSan uses C++ standard library headers.
if (TARGET cxx-headers OR HAVE_LIBCXX)
- set(TSAN_DEPS cxx-headers)
+ list(APPEND TSAN_DEPS cxx-headers)
endif()
# add_tsan_unittest(<name>
More information about the llvm-commits
mailing list