// Add the deployment target.
unsigned TargetVersion[3];
DarwinTC.getTargetVersion(TargetVersion);
- CmdArgs.push_back(DarwinTC.isTargetIPhoneOS() ? "-iphoneos_version_min" :
- "-macosx_version_min");
+
+ // If we had an explicit -mios-simulator-version-min argument, honor that,
+ // otherwise use the traditional deployment targets. We can't just check the
+ // is-sim attribute because existing code follows this path, and the linker
+ // may not handle the argument.
+ //
+ // FIXME: We may be able to remove this, once we can verify no one depends on
+ // it.
+ if (Args.hasArg(options::OPT_mios_simulator_version_min_EQ))
+ CmdArgs.push_back("-ios_simulator_version_min");
+ else if (DarwinTC.isTargetIPhoneOS())
+ CmdArgs.push_back("-iphoneos_version_min");
+ else
+ CmdArgs.push_back("-macosx_version_min");
CmdArgs.push_back(Args.MakeArgString(llvm::Twine(TargetVersion[0]) + "." +
llvm::Twine(TargetVersion[1]) + "." +
llvm::Twine(TargetVersion[2])));