r201830 - Fix an assertion failure when invoking dsymutil.

Bob Wilson bob.wilson at apple.com
Thu Feb 20 16:20:07 PST 2014


Author: bwilson
Date: Thu Feb 20 18:20:07 2014
New Revision: 201830

URL: http://llvm.org/viewvc/llvm-project?rev=201830&view=rev
Log:
Fix an assertion failure when invoking dsymutil.

There is no bound architecture for the dsymutil action in the driver. Trying
to check various properties of the target will cause an assertion failure
because the target doesn't get initialized without a bound architecture.
<rdar://problem/16111555>

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=201830&r1=201829&r2=201830&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Feb 20 18:20:07 2014
@@ -893,11 +893,14 @@ DerivedArgList *Darwin::TranslateArgs(co
   DerivedArgList *DAL = MachO::TranslateArgs(Args, BoundArch);
   const OptTable &Opts = getDriver().getOpts();
 
+  // If no architecture is bound, none of the translations here are relevant.
+  if (!BoundArch)
+    return DAL;
+
   // Add an explicit version min argument for the deployment target. We do this
   // after argument translation because -Xarch_ arguments may add a version min
   // argument.
-  if (BoundArch)
-    AddDeploymentTarget(*DAL);
+  AddDeploymentTarget(*DAL);
 
   // For iOS 6, undo the translation to add -static for -mkernel/-fapple-kext.
   // FIXME: It would be far better to avoid inserting those -static arguments,

Modified: cfe/trunk/test/Driver/darwin-dsymutil.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-dsymutil.c?rev=201830&r1=201829&r2=201830&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-dsymutil.c (original)
+++ cfe/trunk/test/Driver/darwin-dsymutil.c Thu Feb 20 18:20:07 2014
@@ -43,3 +43,6 @@
 // RUN: FileCheck -check-prefix=CHECK-LOCATION < %t %s
 
 // CHECK-LOCATION: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["bar/foo"], output: "bar/foo.dSYM"
+
+// Check that we don't crash when translating arguments for dsymutil.
+// RUN: %clang -m32 -arch x86_64 -g %s -###





More information about the cfe-commits mailing list