Skip to content

Add initial support for "none" triples using the Swift Build backend #9023

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Sources/SwiftBuildSupport/SwiftBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,16 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
}
}

// FIXME: "none" triples get a placeholder SDK/platform and don't support any specific triple by default. Unlike most platforms, where the vendor and environment is implied as a function of the arch and "platform", bare metal operates in terms of triples directly. We need to replace this bringup convenience with a more idiomatic mechanism, perhaps in the build request.
if buildParameters.triple.os == .noneOS {
settings["ARCHS"] = buildParameters.triple.archName
settings["VALID_ARCHS"] = buildParameters.triple.archName
settings["LLVM_TARGET_TRIPLE_VENDOR"] = buildParameters.triple.vendorName
if !buildParameters.triple.environmentName.isEmpty {
settings["LLVM_TARGET_TRIPLE_SUFFIX"] = "-" + buildParameters.triple.environmentName
}
}

settings["LIBRARY_SEARCH_PATHS"] = try "$(inherited) \(buildParameters.toolchain.toolchainLibDir.pathString)"
settings["OTHER_CFLAGS"] = (
["$(inherited)"]
Expand Down