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.
This commit is contained in:
3405691582
2025-04-18 15:53:29 -04:00
parent 9cd378777d
commit d54e67cae1

View File

@@ -291,6 +291,13 @@ StringRef swift::getMajorArchitectureName(const llvm::Triple &Triple) {
break;
}
}
if (Triple.isOSOpenBSD()) {
if (Triple.getArchName() == "amd64") {
return "x86_64";
}
}
return Triple.getArchName();
}
@@ -422,6 +429,11 @@ llvm::Triple swift::getTargetSpecificModuleTriple(const llvm::Triple &triple) {
return swift::getUnversionedTriple(triple);
}
if (triple.isOSOpenBSD()) {
StringRef arch = swift::getMajorArchitectureName(triple);
return llvm::Triple(arch, triple.getVendorName(), triple.getOSName());
}
// Other platforms get no normalization.
return triple;
}