From 5192b22c77c1cf321c13e76bbaba2b85864a2894 Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 18 Apr 2025 15:44:01 -0400 Subject: [PATCH] Use LLVM-default spellings for amd64 on OpenBSD. OpenBSD spells the common 64-bit x86 architecture as amd64, while LLVM defaults it to x86_64. A while back we tried to stick with the amd64 spelling, but this was difficult to make the change properly and consistently. A while back we decided to just stick with LLVM spellings, but there are a few minor cases missing. This change is necessary for properly finding swiftrt.o. --- .../Jobs/GenericUnixToolchain+LinkerSupport.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift index b2ed42b41..33d2952d6 100644 --- a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift +++ b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift @@ -18,7 +18,10 @@ import struct TSCBasic.AbsolutePath extension GenericUnixToolchain { private func majorArchitectureName(for triple: Triple) -> String { // The concept of a "major" arch name only applies to Linux triples - guard triple.os == .linux else { return triple.archName } + // We change spellings for amd64/x86_64 for OpenBSD here too to match LLVM. + guard triple.os == .linux || triple.os == .openbsd else { return triple.archName } + + if triple.os == .openbsd && triple.archName == "amd64" { return "x86_64" } // HACK: We don't wrap LLVM's ARM target architecture parsing, and we should // definitely not try to port it. This check was only normalizing