Skip to content

Commit d54e67c

Browse files
committed
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.
1 parent 9cd3787 commit d54e67c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Basic/Platform.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ StringRef swift::getMajorArchitectureName(const llvm::Triple &Triple) {
291291
break;
292292
}
293293
}
294+
295+
if (Triple.isOSOpenBSD()) {
296+
if (Triple.getArchName() == "amd64") {
297+
return "x86_64";
298+
}
299+
}
300+
294301
return Triple.getArchName();
295302
}
296303

@@ -422,6 +429,11 @@ llvm::Triple swift::getTargetSpecificModuleTriple(const llvm::Triple &triple) {
422429
return swift::getUnversionedTriple(triple);
423430
}
424431

432+
if (triple.isOSOpenBSD()) {
433+
StringRef arch = swift::getMajorArchitectureName(triple);
434+
return llvm::Triple(arch, triple.getVendorName(), triple.getOSName());
435+
}
436+
425437
// Other platforms get no normalization.
426438
return triple;
427439
}

0 commit comments

Comments
 (0)