[cfe-commits] r151185 - in /cfe/trunk: lib/Driver/Driver.cpp test/Driver/Inputs/prefixed_tools_tree/ test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld test/Driver/prefixed-tools.c

Joerg Sonnenberger joerg at bec.de
Wed Feb 22 11:15:16 PST 2012


Author: joerg
Date: Wed Feb 22 13:15:16 2012
New Revision: 151185

URL: http://llvm.org/viewvc/llvm-project?rev=151185&view=rev
Log:
Revert part of r148839 and keep DefaultTargetTriple in the form adjusted
by -target and similar options. As discussed in PR 12026, the change
broke support for target-prefixed tools, i.e. calling x86_64--linux-ld
when compiling for x86_64--linux. Improve the test cases added
originally in r149083 to not require execution, just executable files.
Document the hack with appropiate FIXME comments.

Added:
    cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/
    cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as   (with props)
    cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld   (with props)
    cfe/trunk/test/Driver/prefixed-tools.c
Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=151185&r1=151184&r2=151185&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Feb 22 13:15:16 2012
@@ -310,6 +310,10 @@
       Cur = Split.second;
     }
   }
+  // FIXME: DefaultTargetTriple is used by the target-prefixed calls to as/ld
+  // and getToolChain is const.
+  if (const Arg *A = Args->getLastArg(options::OPT_target))
+    DefaultTargetTriple = A->getValue(*Args);
   if (const Arg *A = Args->getLastArg(options::OPT_ccc_install_dir))
     Dir = InstalledDir = A->getValue(*Args);
   for (arg_iterator it = Args->filtered_begin(options::OPT_B),
@@ -1513,6 +1517,7 @@
 
 std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
                                    bool WantFile) const {
+  // FIXME: Needs a better variable than DefaultTargetTriple
   std::string TargetSpecificExecutable(DefaultTargetTriple + "-" + Name);
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when lokup up program paths.
@@ -1583,6 +1588,7 @@
 static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
                                         const ArgList &Args,
                                         StringRef DarwinArchName) {
+  // FIXME: Already done in Compilation *Driver::BuildCompilation
   if (const Arg *A = Args.getLastArg(options::OPT_target))
     DefaultTargetTriple = A->getValue(Args);
 

Added: cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as?rev=151185&view=auto
==============================================================================
--- cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as (added)
+++ cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as Wed Feb 22 13:15:16 2012
@@ -0,0 +1,2 @@
+#!/bin/sh
+# This file must be executable to be picked up by GetProgramPath

Propchange: cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as
------------------------------------------------------------------------------
    svn:executable = *

Added: cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld?rev=151185&view=auto
==============================================================================
--- cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld (added)
+++ cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld Wed Feb 22 13:15:16 2012
@@ -0,0 +1,2 @@
+#!/bin/sh
+# This file must be executable to be picked up by GetProgramPath

Propchange: cfe/trunk/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld
------------------------------------------------------------------------------
    svn:executable = *

Added: cfe/trunk/test/Driver/prefixed-tools.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/prefixed-tools.c?rev=151185&view=auto
==============================================================================
--- cfe/trunk/test/Driver/prefixed-tools.c (added)
+++ cfe/trunk/test/Driver/prefixed-tools.c Wed Feb 22 13:15:16 2012
@@ -0,0 +1,12 @@
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN:        -target x86_64--linux %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-M64 %s
+
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN:        -m32 -target x86_64--linux %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-M32 %s
+
+// CHECK-M64: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-as"
+// CHECK-M64: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-ld"
+// CHECK-M32: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-as"
+// CHECK-M32: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-ld"





More information about the cfe-commits mailing list