Skip to content

[TySan][CMake] Depend on tysan for check-tysan in runtimes build #143597

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

Merged
merged 2 commits into from
Jun 11, 2025

Conversation

boomanaiden154
Copy link
Contributor

The runtimes build expects libclang_rt.tysan.a to be available, but the check-tysan target does not actually depend on it when built using a runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means we get test failures when running check-compiler-rt due to the missing static archive.

This patch also makes check-tysan depend on tysan when we are using the runtimes build.

This is causing premerge failures currently since we recently migrated to the runtimes build.

The runtimes build expects libclang_rt.tysan.a to be available, but the
check-tysan target does not actually depend on it when built using a
runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means
we get test failures when running check-compiler-rt due to the missing
static archive.

This patch also makes check-tysan depend on tysan when we are using the
runtimes build.
@llvmbot
Copy link
Member

llvmbot commented Jun 10, 2025

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

Author: Aiden Grossman (boomanaiden154)

Changes

The runtimes build expects libclang_rt.tysan.a to be available, but the check-tysan target does not actually depend on it when built using a runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means we get test failures when running check-compiler-rt due to the missing static archive.

This patch also makes check-tysan depend on tysan when we are using the runtimes build.

This is causing premerge failures currently since we recently migrated to the runtimes build.


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

1 Files Affected:

  • (modified) compiler-rt/test/tysan/CMakeLists.txt (+1-1)
diff --git a/compiler-rt/test/tysan/CMakeLists.txt b/compiler-rt/test/tysan/CMakeLists.txt
index 76f57501e854e..6f1beef65ee46 100644
--- a/compiler-rt/test/tysan/CMakeLists.txt
+++ b/compiler-rt/test/tysan/CMakeLists.txt
@@ -21,7 +21,7 @@ foreach(arch ${TYSAN_TEST_ARCH})
 endforeach()
 
 set(TYSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
-if(NOT COMPILER_RT_STANDALONE_BUILD)
+if(NOT COMPILER_RT_STANDALONE_BUILD OR LLVM_RUNTIMES_BUILD)
   list(APPEND TYSAN_TEST_DEPS tysan)
 endif()
 

@@ -21,7 +21,7 @@ foreach(arch ${TYSAN_TEST_ARCH})
endforeach()

set(TYSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
if(NOT COMPILER_RT_STANDALONE_BUILD OR LLVM_RUNTIMES_BUILD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused: Shouldn't COMPILER_RT_STANDALONE_BUILD always be false for a runtimes build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially? It definitely is set to true though.

It looks like the runtimes build is setup in such a way that the check below ends up firing because for whatever reason CMAKE_SOURCE_DIR is set to compiler-rt/

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! Standalone is a separate, third build type next to runtimes and project, so I'm quite surprised that the runtimes build also identifies as a standalone build.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the runtimes build uses the standalone build, so a runtimes build makes standalone compiler-rt cmake builds.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other sanitizers do this unconditionally, so can we just remove the if?

Copy link
Contributor Author

@boomanaiden154 boomanaiden154 Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it. I was looking at rtsan for what I thought was a simple example, but it seems like its the odd one out.

Not sure if there was a reason for doing it this way in the first place though (some dependency on clang)?

@boomanaiden154 boomanaiden154 merged commit 3cef099 into llvm:main Jun 11, 2025
7 checks passed
@boomanaiden154 boomanaiden154 deleted the fix-premerge-tysan-cmake branch June 11, 2025 01:06
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…m#143597)

The runtimes build expects libclang_rt.tysan.a to be available, but the
check-tysan target does not actually depend on it when built using a
runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means
we get test failures when running check-compiler-rt due to the missing
static archive.

This patch also makes check-tysan depend on tysan when we are using the
runtimes build.

This is causing premerge failures currently since we recently migrated
to the runtimes build.
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…m#143597)

The runtimes build expects libclang_rt.tysan.a to be available, but the
check-tysan target does not actually depend on it when built using a
runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means
we get test failures when running check-compiler-rt due to the missing
static archive.

This patch also makes check-tysan depend on tysan when we are using the
runtimes build.

This is causing premerge failures currently since we recently migrated
to the runtimes build.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
…m#143597)

The runtimes build expects libclang_rt.tysan.a to be available, but the
check-tysan target does not actually depend on it when built using a
runtimes build with LLVM_ENABLE_RUNTIMES pointing at ./llvm. This means
we get test failures when running check-compiler-rt due to the missing
static archive.

This patch also makes check-tysan depend on tysan when we are using the
runtimes build.

This is causing premerge failures currently since we recently migrated
to the runtimes build.
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