Improve hermetic toolchain support, add static stdlib support - #1853
Merged
Conversation
keith
force-pushed
the
ks/use-hermetic-toolchain-on-linux-ci
branch
from
July 10, 2026 23:47
ea8fc68 to
d6a1072
Compare
keith
marked this pull request as ready for review
July 24, 2026 03:19
keith
requested review from
aaronsky,
adincebic,
brentleyjones and
luispadron
as code owners
July 24, 2026 03:19
aaronsky
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously hermetic toolchains for the host didn't work correctly
because the shared runtime rpaths wasn't setup correctly. As part of
trying to fix that I implemented static-stdlib support hoping to enable
that by default. Unfortunately the Swift toolchain doesn't ship a static
XCTest version, so you can't use static-stdlib 100% of the time. This
means toolchains that want to support this feature must provide dynamic
and static runtimes, and we pick between those in the rules.
New behavior:
dynamic_runtime(previouslyruntime)andstatic_runtimefilesswift_test) default to staticallylinking the swift stdlib. This makes these binaries more portable, but
also makes them larger
swift_testtargets are always linked dynamicallylibraries are provided for linking, and bazel automatically adds the
correct rpaths
toolchain), the behavior is unchanged. We still add a non-hermetic
rpath to the system Swift install directory.
swift.static_stdlibfeature. Setting it on non-linux platforms does nothingdefault cc_toolchain based on Swift's installed
clang.General setup:
This registers the relevant toolchains for Swift and C++
(required for linking even if you don't have any C/C++)
Closes #1686
Work towards #8
Work towards #1813
Work towards #1816