r200618 - Fix an assertion failure when building for the iOS simulator. rdar://15959009

Bob Wilson bob.wilson at apple.com
Sat Feb 1 13:06:22 PST 2014


Author: bwilson
Date: Sat Feb  1 15:06:21 2014
New Revision: 200618

URL: http://llvm.org/viewvc/llvm-project?rev=200618&view=rev
Log:
Fix an assertion failure when building for the iOS simulator. rdar://15959009

When building for i386 or x86_64 with IPHONEOS_DEPLOYMENT_TARGET set in the
environment, the toolchain correctly recognizes that the target platform is
the iOS simulator. The code in Darwin::addMinVersionArgs was not updated for
svn 197148, where isTargetIPhoneOS() was widely replaced by isTargetIOSBased().
This is kind of a strange case, though, because we probably ought to be
passing -ios_simulator_version_min to the linker, but according to the FIXME
in the code, we intentionally avoid that unless the -mios-simulator-version-min
option was used. I don't know whether it is safe to change that yet, so
for now, I am just fixing the assertion failure.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=200618&r1=200617&r2=200618&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sat Feb  1 15:06:21 2014
@@ -991,7 +991,7 @@ void Darwin::addMinVersionArgs(const llv
   // it.
   if (Args.hasArg(options::OPT_mios_simulator_version_min_EQ))
     CmdArgs.push_back("-ios_simulator_version_min");
-  else if (isTargetIPhoneOS())
+  else if (isTargetIOSBased())
     CmdArgs.push_back("-iphoneos_version_min");
   else {
     assert(isTargetMacOS() && "unexpected target");

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=200618&r1=200617&r2=200618&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Sat Feb  1 15:06:21 2014
@@ -173,3 +173,11 @@
 //
 // LINK_X86_64H_MULTIARCH: {{ld(.exe)?"}}
 // LINK_X86_64H_MULTIARCH: "x86_64h"
+
+// Check that clang passes -iphoneos_version_min to the linker when building
+// for the iOS simulator but when -mios-simulator-version-min is not
+// explicitly specified (<rdar://problem/15959009>).
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
+// RUN:   %clang -target i386-apple-darwin -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_IPHONEOS_VERSION_MIN %s < %t.log
+// LINK_IPHONEOS_VERSION_MIN: -iphoneos_version_min





More information about the cfe-commits mailing list