[compiler-rt] Add check-builtins target for LLVM_ENABLE_RUNTIMES builds #166837
+52
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When doing a LLVM_ENABLE_RUNTIMES-based build of clang+compiler_rt, the
check-builtinstarget is missing and builtins tests are not run (#112105, #144090).This provides one possible path forward for enabling these tests.
The approach taken here is to test the builtins with the
compiler-rtruntime build (i.e. only if you passLLVM_ENABLE_RUNTIMES='compiler-rt'). The builtins tests currently rely on shared test infrastructure incompiler-rt/, so this is probably the easiest solution without relocating the builtins and their tests outside ofcompiler-rt/.The main challenge is that the built-ins test configuration expects to be able to inspect the builtin target and see the sources used to build it:
Since the builtins build and runtimes build are separate under LLVM_ENABLE_RUNTIMES, this target inspection is not possible. To get around this, we write a temporary file alongside each builtins library containing the list of sources (e.g.
"${CMAKE_BINARY_DIR}/clang_rt.builtins-${arch}.sources.txt"). Then, we introduce an undocumented compiler-rt optionCOMPILER_RT_FORCE_TEST_BUILTINS_DIR(which is only intended to be used by the LLVM_ENABLE_RUNTIMES build, and could be removed after builtins re relocated) that passes the path to the directory containing this file, and configures builtins tests (even though the runtimes build hasCOMPILER_RT_BUILD_BUILTINS=OFF)