From 67ba210b7e321f229eb750fb593e9f2766f5b096 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 11 Aug 2025 10:01:30 -0700 Subject: [PATCH] Add initial support for "none" triples using the Swift Build backend This will need to be cleaned up later as we refine how target triples are communicated through the build request, but will allow us to start experimenting with more Swift Embedded workflows in the meantime. --- Sources/SwiftBuildSupport/SwiftBuildSystem.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/SwiftBuildSupport/SwiftBuildSystem.swift b/Sources/SwiftBuildSupport/SwiftBuildSystem.swift index c9bbdd09f0b..a5d8f63bd33 100644 --- a/Sources/SwiftBuildSupport/SwiftBuildSystem.swift +++ b/Sources/SwiftBuildSupport/SwiftBuildSystem.swift @@ -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)"]