Skip to content

Commit 6f9297f

Browse files
authored
[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 #83088. Reviewed By: vitalybuka Pull Request: #83650
1 parent 00f3454 commit 6f9297f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler-rt/cmake/Modules/CompilerRTCompile.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function(sanitizer_test_compile obj_list source arch)
4646
# Write out architecture-specific flags into TARGET_CFLAGS variable.
4747
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
4848
set(COMPILE_DEPS ${TEST_COMPILE_DEPS})
49-
if(NOT COMPILER_RT_STANDALONE_BUILD)
49+
if(NOT COMPILER_RT_STANDALONE_BUILD OR COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
5050
list(APPEND COMPILE_DEPS ${TEST_DEPS})
5151
endif()
5252
clang_compile(${output_obj} ${source}

compiler-rt/lib/msan/tests/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ macro(msan_compile obj_list source arch kind cflags)
6969
sanitizer_test_compile(
7070
${obj_list} ${source} ${arch}
7171
KIND ${kind}
72-
COMPILE_DEPS ${MSAN_UNITTEST_HEADERS}
72+
COMPILE_DEPS ${MSAN_UNITTEST_HEADERS} libcxx_msan_${arch}-build
7373
DEPS msan
74-
CFLAGS -isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1
74+
CFLAGS -isystem ${MSAN_LIBCXX_DIR}/../include/c++/v1
7575
${MSAN_UNITTEST_INSTRUMENTED_CFLAGS} ${cflags}
7676
)
7777
endmacro()
@@ -120,7 +120,7 @@ macro(add_msan_tests_for_arch arch kind cflags)
120120
set(MSAN_TEST_DEPS ${MSAN_TEST_OBJECTS} libcxx_msan_${arch}-build
121121
${MSAN_LOADABLE_SO}
122122
"${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a")
123-
list(APPEND MSAN_TEST_DEPS msan)
123+
list(APPEND MSAN_TEST_DEPS msan libcxx_msan_${arch}-build)
124124
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
125125
add_compiler_rt_test(MsanUnitTests "Msan-${arch}${kind}-Test" ${arch}
126126
OBJECTS ${MSAN_TEST_OBJECTS} "${MSAN_LIBCXX_DIR}/libc++.a" "${MSAN_LIBCXX_DIR}/libc++abi.a"

compiler-rt/lib/tsan/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ endforeach()
6767
set(TSAN_DEPS tsan)
6868
# TSan uses C++ standard library headers.
6969
if (TARGET cxx-headers OR HAVE_LIBCXX)
70-
set(TSAN_DEPS cxx-headers)
70+
list(APPEND TSAN_DEPS cxx-headers)
7171
endif()
7272

7373
# add_tsan_unittest(<name>

0 commit comments

Comments
 (0)