Handle 'invalid' default LLVM target triples (#3972)

By normalizing them, to resolve issues like #3971.
This commit is contained in:
Martin Kinkelin 2022-04-29 01:47:19 +02:00 committed by GitHub
parent aa039aacf3
commit 490bdcb0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -351,7 +351,8 @@ createTargetMachine(const std::string targetTriple, const std::string arch,
// the one set at LLVM configure time.
llvm::Triple triple;
if (targetTriple.empty()) {
triple = llvm::Triple(llvm::sys::getDefaultTargetTriple());
triple = llvm::Triple(
llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple()));
// We only support OSX, so darwin should really be macosx.
if (triple.getOS() == llvm::Triple::Darwin) {