[lld] r249122 - Use ld.lld2 as a argv[0] alias.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 05:57:34 PDT 2015


Author: rafael
Date: Fri Oct  2 07:57:34 2015
New Revision: 249122

URL: http://llvm.org/viewvc/llvm-project?rev=249122&view=rev
Log:
Use ld.lld2 as a argv[0] alias.

The reason for the name is so that we can run

./build/bin/clang -fuse-ld=lld2 test.o -o t

Modified:
    lld/trunk/lib/Driver/UniversalDriver.cpp
    lld/trunk/test/elf2/basic.s
    lld/trunk/tools/lld/CMakeLists.txt

Modified: lld/trunk/lib/Driver/UniversalDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/UniversalDriver.cpp?rev=249122&r1=249121&r2=249122&view=diff
==============================================================================
--- lld/trunk/lib/Driver/UniversalDriver.cpp (original)
+++ lld/trunk/lib/Driver/UniversalDriver.cpp Fri Oct  2 07:57:34 2015
@@ -86,6 +86,7 @@ static Flavor strToFlavor(StringRef str)
   return llvm::StringSwitch<Flavor>(str)
       .Case("gnu", Flavor::gnu_ld)
       .Case("gnu2", Flavor::gnu_ld2)
+      .Case("ld.lld2", Flavor::gnu_ld2)
       .Case("link", Flavor::win_link)
       .Case("lld-link", Flavor::win_link)
       .Case("darwin", Flavor::darwin_ld)
@@ -156,7 +157,9 @@ static Flavor getFlavor(llvm::MutableArr
   }
 #endif
 
-  StringRef name = llvm::sys::path::stem(args[0]);
+  StringRef name = llvm::sys::path::filename(args[0]);
+  if (name.endswith_lower(".exe"))
+    name = llvm::sys::path::stem(name);
   return strToFlavor(parseProgramName(name)._flavor);
 }
 

Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=249122&r1=249121&r2=249122&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Fri Oct  2 07:57:34 2015
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: lld -flavor gnu2 %t -o %t2
+# RUN: ld.lld2 %t -o %t2
 # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
 # RUN:   | FileCheck %s
 

Modified: lld/trunk/tools/lld/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld/CMakeLists.txt?rev=249122&r1=249121&r2=249122&view=diff
==============================================================================
--- lld/trunk/tools/lld/CMakeLists.txt (original)
+++ lld/trunk/tools/lld/CMakeLists.txt Fri Oct  2 07:57:34 2015
@@ -12,7 +12,7 @@ install(TARGETS lld
   RUNTIME DESTINATION bin)
 
 if(NOT LLD_SYMLINKS_TO_CREATE)
-  set(LLD_SYMLINKS_TO_CREATE lld-link)
+  set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld2)
 endif()
 
 foreach(link ${LLD_SYMLINKS_TO_CREATE})




More information about the llvm-commits mailing list