]> granicus.if.org Git - clang/commitdiff
Fix an assertion failure when invoking dsymutil.
authorBob Wilson <bob.wilson@apple.com>
Fri, 21 Feb 2014 00:20:07 +0000 (00:20 +0000)
committerBob Wilson <bob.wilson@apple.com>
Fri, 21 Feb 2014 00:20:07 +0000 (00:20 +0000)
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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
test/Driver/darwin-dsymutil.c

index c071a9833cf10484382948a3f1019bde309f3107..4d29a51f4f8b74e7669f7ac932e808422dc66f4e 100644 (file)
@@ -893,11 +893,14 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
   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,
index b8c3083c93536dab138aa63a7146349023302486..59084a2c85ed56186b8aa2a46f52298299ada358 100644 (file)
@@ -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 -###