aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-05-09 18:09:58 +0000
committerChad Rosier <mcrosier@apple.com>2012-05-09 18:09:58 +0000
commit87ca5580302561c839b2cd12207902b9bf4ed117 (patch)
tree20717aa5df30cd9dd10f76689a849d40371ac2a0
parent30a0908aeb54ecef0eedf14b2ea62a896a9909dc (diff)
[driver] Use the iOS target triple to infer the deployment target.
rdar://11409204 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156489 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChains.cpp10
-rw-r--r--test/Driver/target-triple-deployment.c33
2 files changed, 41 insertions, 2 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index cc1adb1ea8..86fef4fe69 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -524,8 +524,14 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
// If no OSX or iOS target has been specified and we're compiling for armv7,
// go ahead as assume we're targeting iOS.
if (OSXTarget.empty() && iOSTarget.empty())
- if (getDarwinArchName(Args) == "armv7")
- iOSTarget = "0.0";
+ if (getDarwinArchName(Args) == "armv7") {
+ std::string iOSVersionMin;
+ unsigned Major, Minor, Micro;
+ getTriple().getiOSVersion(Major, Minor, Micro);
+ llvm::raw_string_ostream(iOSVersionMin)
+ << Major << '.' << Minor << '.' << Micro;
+ iOSTarget = iOSVersionMin;
+ }
// Handle conflicting deployment targets
//
diff --git a/test/Driver/target-triple-deployment.c b/test/Driver/target-triple-deployment.c
new file mode 100644
index 0000000000..56e512c960
--- /dev/null
+++ b/test/Driver/target-triple-deployment.c
@@ -0,0 +1,33 @@
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-apple-macosx -### %t.o 2> %t.log
+// RUN: %clang -target x86_64-apple-darwin9 -### %t.o 2>> %t.log
+// RUN: %clang -target x86_64-apple-macosx10.7 -### %t.o 2>> %t.log
+//
+// RUN: %clang -target armv7-apple-ios -### %t.o 2>> %t.log
+// RUN: %clang -target armv7-apple-ios0.0 -### %t.o 2>> %t.log
+// RUN: %clang -target armv7-apple-ios1.2.3 -### %t.o 2>> %t.log
+// RUN: %clang -target armv7-apple-ios5.0 -### %t.o 2>> %t.log
+//
+// RUN: FileCheck %s < %t.log
+
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -macosx_version_min
+// CHECK: 10.4.0
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -macosx_version_min
+// CHECK: 10.5.0
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -macosx_version_min
+// CHECK: 10.7.0
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -iphoneos_version_min
+// CHECK: 0.0.0
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -iphoneos_version_min
+// CHECK: 0.0.0
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -iphoneos_version_min
+// CHECK: 1.2.3
+// CHECK: {{ld(.exe)?"}}
+// CHECK: -iphoneos_version_min
+// CHECK: 5.0.0