aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-04-30 04:18:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-04-30 04:18:16 +0000
commit5f5c37b1234e6ebb6c17e084bc4e2cce92e31585 (patch)
treecb342b4c35a74ea1eeec53f7503871a4f1bed435
parent9d609f2b0dd604879f8b284ded1f14ba300e8070 (diff)
Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130592 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChains.cpp12
-rw-r--r--lib/Driver/ToolChains.h24
2 files changed, 24 insertions, 12 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 3602410b2c..838e5bf2eb 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -477,7 +477,17 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
<< Version->getAsString(Args);
}
- setTarget(/*isIPhoneOS=*/ !OSXVersion, Major, Minor, Micro);
+ bool IsIOSSim = bool(iOSSimVersion);
+
+ // In GCC, the simulator historically was treated as being OS X in some
+ // contexts, like determining the link logic, despite generally being called
+ // with an iOS deployment target. For compatibility, we detect the
+ // simulator as iOS + x86, and treat it differently in a few contexts.
+ if (iOSVersion && (getTriple().getArch() == llvm::Triple::x86 ||
+ getTriple().getArch() == llvm::Triple::x86_64))
+ IsIOSSim = true;
+
+ setTarget(/*IsIPhoneOS=*/ !OSXVersion, Major, Minor, Micro, IsIOSSim);
}
void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 6265f3d7d4..7a1a050252 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -60,6 +60,9 @@ private:
/// Whether we are targeting iPhoneOS target.
mutable bool TargetIsIPhoneOS;
+ /// Whether we are targeting the iPhoneOS simulator target.
+ mutable bool TargetIsIPhoneOSSimulator;
+
/// The OS version we are targeting.
mutable unsigned TargetVersion[3];
@@ -81,18 +84,22 @@ public:
// FIXME: Eliminate these ...Target functions and derive separate tool chains
// for these targets and put version in constructor.
- void setTarget(bool isIPhoneOS, unsigned Major, unsigned Minor,
- unsigned Micro) const {
+ void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor,
+ unsigned Micro, bool IsIOSSim) const {
+ assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!");
+
// FIXME: For now, allow reinitialization as long as values don't
// change. This will go away when we move away from argument translation.
- if (TargetInitialized && TargetIsIPhoneOS == isIPhoneOS &&
+ if (TargetInitialized && TargetIsIPhoneOS == IsIPhoneOS &&
+ TargetIsIPhoneOSSimulator == IsIOSSim &&
TargetVersion[0] == Major && TargetVersion[1] == Minor &&
TargetVersion[2] == Micro)
return;
assert(!TargetInitialized && "Target already initialized!");
TargetInitialized = true;
- TargetIsIPhoneOS = isIPhoneOS;
+ TargetIsIPhoneOS = IsIPhoneOS;
+ TargetIsIPhoneOSSimulator = IsIOSSim;
TargetVersion[0] = Major;
TargetVersion[1] = Minor;
TargetVersion[2] = Micro;
@@ -104,13 +111,8 @@ public:
}
bool isTargetIOSSimulator() const {
- // In GCC, the simulator historically was treated as being OS X in some
- // contexts, like determining the link logic, despite generally being called
- // with an iOS deployment target. For compatibility, we detect the
- // simulator is iOS + x86, and treat it differently in a few contexts.
- return isTargetIPhoneOS() &&
- (getTriple().getArch() == llvm::Triple::x86 ||
- getTriple().getArch() == llvm::Triple::x86_64);
+ assert(TargetInitialized && "Target not initialized!");
+ return TargetIsIPhoneOSSimulator;
}
bool isTargetInitialized() const { return TargetInitialized; }