Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it. llvm-svn: 130592
This commit is contained in:
parent
9aaeb6400b
commit
b1189434dd
|
@ -477,7 +477,17 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
|
||||||
<< Version->getAsString(Args);
|
<< 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,
|
void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
|
||||||
|
|
|
@ -60,6 +60,9 @@ private:
|
||||||
/// Whether we are targeting iPhoneOS target.
|
/// Whether we are targeting iPhoneOS target.
|
||||||
mutable bool TargetIsIPhoneOS;
|
mutable bool TargetIsIPhoneOS;
|
||||||
|
|
||||||
|
/// Whether we are targeting the iPhoneOS simulator target.
|
||||||
|
mutable bool TargetIsIPhoneOSSimulator;
|
||||||
|
|
||||||
/// The OS version we are targeting.
|
/// The OS version we are targeting.
|
||||||
mutable unsigned TargetVersion[3];
|
mutable unsigned TargetVersion[3];
|
||||||
|
|
||||||
|
@ -81,18 +84,22 @@ public:
|
||||||
|
|
||||||
// FIXME: Eliminate these ...Target functions and derive separate tool chains
|
// FIXME: Eliminate these ...Target functions and derive separate tool chains
|
||||||
// for these targets and put version in constructor.
|
// for these targets and put version in constructor.
|
||||||
void setTarget(bool isIPhoneOS, unsigned Major, unsigned Minor,
|
void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor,
|
||||||
unsigned Micro) const {
|
unsigned Micro, bool IsIOSSim) const {
|
||||||
|
assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!");
|
||||||
|
|
||||||
// FIXME: For now, allow reinitialization as long as values don't
|
// FIXME: For now, allow reinitialization as long as values don't
|
||||||
// change. This will go away when we move away from argument translation.
|
// 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[0] == Major && TargetVersion[1] == Minor &&
|
||||||
TargetVersion[2] == Micro)
|
TargetVersion[2] == Micro)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert(!TargetInitialized && "Target already initialized!");
|
assert(!TargetInitialized && "Target already initialized!");
|
||||||
TargetInitialized = true;
|
TargetInitialized = true;
|
||||||
TargetIsIPhoneOS = isIPhoneOS;
|
TargetIsIPhoneOS = IsIPhoneOS;
|
||||||
|
TargetIsIPhoneOSSimulator = IsIOSSim;
|
||||||
TargetVersion[0] = Major;
|
TargetVersion[0] = Major;
|
||||||
TargetVersion[1] = Minor;
|
TargetVersion[1] = Minor;
|
||||||
TargetVersion[2] = Micro;
|
TargetVersion[2] = Micro;
|
||||||
|
@ -104,13 +111,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTargetIOSSimulator() const {
|
bool isTargetIOSSimulator() const {
|
||||||
// In GCC, the simulator historically was treated as being OS X in some
|
assert(TargetInitialized && "Target not initialized!");
|
||||||
// contexts, like determining the link logic, despite generally being called
|
return TargetIsIPhoneOSSimulator;
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTargetInitialized() const { return TargetInitialized; }
|
bool isTargetInitialized() const { return TargetInitialized; }
|
||||||
|
|
Loading…
Reference in New Issue