Miscellaneous fixes for Wasm platform toward SwiftPM integration#998
Open
kateinoigakukun wants to merge 6 commits intoswiftlang:mainfrom
Open
Miscellaneous fixes for Wasm platform toward SwiftPM integration#998kateinoigakukun wants to merge 6 commits intoswiftlang:mainfrom
kateinoigakukun wants to merge 6 commits intoswiftlang:mainfrom
Conversation
An artifact variant path allows specifying either a directory containing a `swift-sdk.json` file or the path to the `swift-sdk.json` file itself. Swift SDK for WebAssembly uses this feature to collocate regular SDK and embedded SDK.
…r is supported After swiftlang#236, we no longer need to manually add Swift specific linker flags in the WebAssembly SDK.
kateinoigakukun
commented
Dec 26, 2025
Comment on lines
+209
to
+219
| // The sdkCanonicalName from a Platform is not guaranteed to be available | ||
| let defaultSDKAvailable: Bool | ||
| do { | ||
| let foundSDK = try workspaceContext.core.sdkRegistry.lookup(sdkRoot, activeRunDestination: parameters.activeRunDestination) | ||
| defaultSDKAvailable = foundSDK != nil | ||
| } catch { | ||
| defaultSDKAvailable = false | ||
| } | ||
| if defaultSDKAvailable { | ||
| overrides["SDKROOT"] = sdkRoot | ||
| } |
Member
Author
There was a problem hiding this comment.
I'm not 100% sure if this is the right approach. Do we really need to override SDKROOT here in the first place? The overridden SDKROOT was always platform.sdkCanonicalName, which is always the same as platform.name ("webassembly"), but "webassembly" SDK is unavailable.
I'm a bit lost here because I can't access the git history before it got open-sourced.
Some targets use the resource dir during linking to find files like `static-executable-args.lnk` in swift-driver and compiler-rt libraries in clang. They are normally located under the Swift `-sdk` path or `-sysroot` path, but Swift SDK for Wasm located resource dirs outside of `-sdk`/`-sysroot` path. This patch adds `-resource-dir` flag to the linker driver invocation.
…ot` for now The override is needed because swift-driver currently does not respect `-sysroot` for Wasm targets, but only `-sdk`. This will be fixed in swift-driver in the change: swiftlang/swift-driver#2053
57584f0 to
7f3e767
Compare
Collaborator
|
@cmcgee1024 already has some changes up in #966 which will be restructuring this code substantially. You may want to coordinate on swiftlang/swift-driver#2053 though. |
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.
XDG_CONFIG_HOMEon non-macOS-resource-dirto linker driver-sdkover-sysrootfor nowSDKROOTonly if SDK is availableClose swiftlang/swift-package-manager#9364