From 49ba2910b050fd00eaf4ab602ea23dbf04ac4844 Mon Sep 17 00:00:00 2001 From: Dan Olson Date: Thu, 12 Nov 2015 10:52:05 -0800 Subject: [PATCH] OS X - default OS to macosx instead of darwin On OS X, the OS in Triple should be macosx, not darwin. This is not comprehensive like clang which has a bunch of darwin to other OS translation rules, but since only Darwin target currently supported is OS X, this does the job. --- driver/main.cpp | 1 + driver/targetmachine.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/driver/main.cpp b/driver/main.cpp index d94bd1eda98..001a6aa0799 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -741,6 +741,7 @@ static void registerPredefinedTargetVersions() { VersionCondition::addPredefinedGlobalIdent("Posix"); break; case llvm::Triple::Darwin: + case llvm::Triple::MacOSX: VersionCondition::addPredefinedGlobalIdent("OSX"); VersionCondition::addPredefinedGlobalIdent( "darwin"); // For backwards compatibility. diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp index 9e55fad87a0..3a0c1ef92c4 100644 --- a/driver/targetmachine.cpp +++ b/driver/targetmachine.cpp @@ -420,6 +420,11 @@ llvm::TargetMachine *createTargetMachine( if (targetTriple.empty()) { triple = llvm::Triple(llvm::sys::getDefaultTargetTriple()); + // We only support OSX, so darwin should really be macosx. + if (triple.getOS() == llvm::Triple::Darwin) { + triple.setOS(llvm::Triple::MacOSX); + } + // Handle -m32/-m64. if (sizeof(void *) == 4 && bitness == ExplicitBitness::M64) { triple = triple.get64BitArchVariant();