-
Notifications
You must be signed in to change notification settings - Fork 10.5k
build-script: Permit to build compiler-rt with LLVM_ENABLE_RUNTIMES
#80174
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
build-script: Permit to build compiler-rt with LLVM_ENABLE_RUNTIMES
#80174
Conversation
@swift-ci please python lint |
@classmethod | ||
def compute_cmake_args_for_runtimes(cls, host_target): | ||
# Swift expects the old layout for the runtime directory | ||
args_for_runtime = '-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR:BOOL=OFF' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that Windows has started migrating to the new layout. clang already prefers the new layout. We should file an issue to bring the other hosts in line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #80180
if self.args.test: | ||
# LLVMTestingSupport is not built at part of `all` | ||
# and is required by some Swift tests | ||
build_targets.append('LLVMTestingSupport') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated to this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed because with LLVM_ENABLE_RUNTIMES
the new runtimes
target does not have any dependencies to LLVMTestingSupport
-- currently that is scheduled as a result of the compiler-rt configuration
I preferred to apply it to the old way of building compiler-rt as well to limit the number of places where I check for the flags -- it should not cause any additional rebuilds there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, if it is required for tests, I think that the tests should add that dependency, not compiler-rt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to do that, but build-script
does not schedule Swift as an external project of LLVM (like build.ps1
does) -- so I cannot put LLVMTestingSupport
as a dependency of the test targets that need that.
@swift-ci please test |
3a7a408
to
442edf4
Compare
@swift-ci please python lint |
@swift-ci please test |
@swift-ci please test Apple Silicon |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
@swift-ci please python lint |
@swift-ci please python lint |
@@ -1398,6 +1398,11 @@ def create_argument_parser(): | |||
'separated options "-DCMAKE_VAR1=YES,-DCMAKE_VAR2=/tmp". Can ' | |||
'be called multiple times to add multiple such options.') | |||
|
|||
option('--llvm-build-compiler-rt-with-use-runtimes', toggle_true, | |||
help='Switch to LLVM_USE_RUNTIMES as the mechanism to build compiler-rt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/LLVM_USE_RUNTIMES/LLVM_ENABLE_RUNTIMES
.
@@ -23,6 +23,10 @@ class CMakeProduct(product.Product): | |||
def is_verbose(self): | |||
return self.args.verbose_build | |||
|
|||
@property | |||
def cmake_os_sysroot(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the property function instead of setting self.cmake_os_sysroot
? If we get an error for trying to use cmake_os_sysroot
before calling host_cmake_options
, this will still result in a failure because self._cmake_os_sysroot
is still undefined so it isn't protecting us from anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make it discoverable that this value can now be accessed outside of this class, and I thought that adding a read only property would help convey this (instead of trawling through the code of build_with_cmake
host_cmake_options
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworked my approach to avoid the use of the property, and instead return the value I am interested in as an outcome from host_cmake_options
@swift-ci please test |
bd12562
to
824fb12
Compare
@swift-ci please python lint |
@swift-ci please test |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility |
LLVM-21 plans to remove the legacy method for building compiler-rt in the same invocation as LLVM using `LLVM_ENABLED_PROJECTS` and `LLVM_BUILD_EXTERNAL_COMPILER_RT`. Support the new way of building compiler-rt with a new build-script opt-in flag `--llvm-build-compiler-rt-with-use-runtimes` -- this will allow a staged introduction, and will ensure we can revert back to the old behaviour temporarily in case of unforeseen regression. Since this flag is meant to be short lived, in an attempt to keep the logic simple we are gating on it only the CMake cache entries that strictly control the compilation mode, all the other entries used for configuring are added in both modes. Take this chance to remove some stale code from `build-script-impl`, and move some code in the generic CMake product to the LLVM one. Addresses rdar://147505298
824fb12
to
0c8171f
Compare
@swift-ci please python lint |
1 similar comment
@swift-ci please python lint |
@swift-ci please test |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility |
@swift-ci please test macOS |
@swift-ci please test Windows |
@swift-ci please build toolchain Windows |
@swift-ci please test macOS |
1 similar comment
@swift-ci please test macOS |
LLVM-21 plans to remove the legacy method for building compiler-rt in the same invocation as LLVM using
LLVM_ENABLED_PROJECTS
andLLVM_BUILD_EXTERNAL_COMPILER_RT
.Support the new way of building compiler-rt with a new build-script opt-in flag
--llvm-build-compiler-rt-with-use-runtimes
-- this will allow a staged introduction, and will ensure we can revert back to the old behaviour temporarily in case of unforeseen regression.Since this flag is meant to be short lived, in an attempt to keep the logic simple we are gating on it only the
CMake cache entries that strictly control the compilation mode, all the other entries used for configuring are added in both modes.
Take this chance to remove some stale code from
build-script-impl
, and move some code in the generic CMake product to the LLVM one.Addresses rdar://147505298