Skip to content

[compiler-rt] Fix build race with COMPILER_RT_TEST_STANDALONE_BUILD_LIBS #83650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

arichardson
Copy link
Member

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.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Mar 2, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Alexander Richardson (arichardson)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/83650.diff

2 Files Affected:

  • (modified) compiler-rt/cmake/Modules/CompilerRTCompile.cmake (+1-1)
  • (modified) compiler-rt/lib/tsan/tests/CMakeLists.txt (+1-1)
diff --git a/compiler-rt/cmake/Modules/CompilerRTCompile.cmake b/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
index 2bf115973a49b3..3d7528ad2e52c0 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/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt
index ad8cc9b0eb05af..1bc08bbf7450c8 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>

@arichardson arichardson requested a review from vitalybuka March 2, 2024 03:10
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
arichardson added a commit to arichardson/upstream-llvm-project that referenced this pull request Mar 7, 2024
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 llvm#83088.

Pull Request: llvm#83650
vzakhari and others added 2 commits March 21, 2024 15:20
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@llvmbot llvmbot added the compiler-rt:msan Memory sanitizer label Mar 21, 2024
@arichardson arichardson changed the base branch from users/arichardson/spr/main.compiler-rt-fix-build-race-with-compiler_rt_test_standalone_build_libs to main March 21, 2024 22:22
@arichardson arichardson merged commit 6f9297f into main Mar 21, 2024
@arichardson arichardson deleted the users/arichardson/spr/compiler-rt-fix-build-race-with-compiler_rt_test_standalone_build_libs branch March 21, 2024 22:22
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
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 llvm#83088.

Reviewed By: vitalybuka

Pull Request: llvm#83650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants