r232556 - Imply linker arguments from '-fveclib' option.

Michael Zolotukhin mzolotukhin at apple.com
Tue Mar 17 15:13:06 PDT 2015


Author: mzolotukhin
Date: Tue Mar 17 17:13:05 2015
New Revision: 232556

URL: http://llvm.org/viewvc/llvm-project?rev=232556&view=rev
Log:
Imply linker arguments from '-fveclib' option.

Summary: As discussed in D8097, we should provide corresponding linking flags when 'fveclib' is specified.

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D8362

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/fveclib.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=232556&r1=232555&r2=232556&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 17 17:13:05 2015
@@ -6138,6 +6138,16 @@ void darwin::Link::ConstructJob(Compilat
     CmdArgs.push_back(Args.MakeArgString(std::string("-F") +
                                          (*it)->getValue()));
 
+  if (!Args.hasArg(options::OPT_nostdlib) &&
+      !Args.hasArg(options::OPT_nodefaultlibs)) {
+    if (Arg *A = Args.getLastArg(options::OPT_fveclib)) {
+      if (A->getValue() == StringRef("Accelerate")) {
+        CmdArgs.push_back("-framework");
+        CmdArgs.push_back("Accelerate");
+      }
+    }
+  }
+
   const char *Exec =
     Args.MakeArgString(getToolChain().GetLinkerPath());
   std::unique_ptr<Command> Cmd =

Modified: cfe/trunk/test/Driver/fveclib.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fveclib.c?rev=232556&r1=232555&r2=232556&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fveclib.c (original)
+++ cfe/trunk/test/Driver/fveclib.c Tue Mar 17 17:13:05 2015
@@ -6,3 +6,12 @@
 // CHECK-ACCELERATE: "-fveclib=Accelerate"
 
 // CHECK-INVALID: error: invalid value 'something' in '-fveclib=something'
+
+// RUN: %clang -fveclib=Accelerate %s -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK %s
+// CHECK-LINK: "-framework" "Accelerate"
+
+// RUN: %clang -fveclib=Accelerate %s -nostdlib -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NOSTDLIB %s
+// CHECK-LINK-NOSTDLIB-NOT: "-framework" "Accelerate"
+
+// RUN: %clang -fveclib=Accelerate %s -nodefaultlibs -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NODEFAULTLIBS %s
+// CHECK-LINK-NODEFAULTLIBS-NOT: "-framework" "Accelerate"





More information about the cfe-commits mailing list