[PATCH] D67461: lld-link: Make /linkrepro: take a filename, not a directory.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 04:44:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL371729: lld-link: Make /linkrepro: take a filename, not a directory. (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67461?vs=219774&id=219885#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67461/new/

https://reviews.llvm.org/D67461

Files:
  lld/trunk/COFF/Driver.cpp
  lld/trunk/docs/ReleaseNotes.rst
  lld/trunk/test/COFF/linkrepro-res.test
  lld/trunk/test/COFF/linkrepro.test


Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -50,7 +50,7 @@
 using namespace llvm;
 using namespace llvm::object;
 using namespace llvm::COFF;
-using llvm::sys::Process;
+using namespace llvm::sys;
 
 namespace lld {
 namespace coff {
@@ -1138,17 +1138,15 @@
   config->mingw = args.hasArg(OPT_lldmingw);
 
   if (auto *arg = args.getLastArg(OPT_linkrepro)) {
-    SmallString<64> path = StringRef(arg->getValue());
-    sys::path::append(path, "repro.tar");
+    const char *path = arg->getValue();
 
     Expected<std::unique_ptr<TarWriter>> errOrWriter =
-        TarWriter::create(path, "repro");
-
+        TarWriter::create(path, path::stem(path));
     if (errOrWriter) {
       tar = std::move(*errOrWriter);
+      tar->append("version.txt", getLLDVersion() + "\n");
     } else {
-      error("/linkrepro: failed to open " + path + ": " +
-            toString(errOrWriter.takeError()));
+      error("/linkrepro: " + toString(errOrWriter.takeError()));
     }
   }
 
Index: lld/trunk/docs/ReleaseNotes.rst
===================================================================
--- lld/trunk/docs/ReleaseNotes.rst
+++ lld/trunk/docs/ReleaseNotes.rst
@@ -29,6 +29,9 @@
 COFF Improvements
 -----------------
 
+* /linkrepro: now takes the filename of the tar archive it writes, instead
+  of the name of a directory that a file called "repro.tar" is created in,
+  matching the behavior of ELF lld.
 * ...
 
 MinGW Improvements
Index: lld/trunk/test/COFF/linkrepro-res.test
===================================================================
--- lld/trunk/test/COFF/linkrepro-res.test
+++ lld/trunk/test/COFF/linkrepro-res.test
@@ -4,7 +4,7 @@
 # RUN: mkdir -p %t.dir/build
 # RUN: cd %t.dir/build
 # RUN: lld-link %p/Inputs/resource.res /subsystem:console /machine:x64 \
-# RUN:   /entry:__ImageBase /linkrepro:. /out:%t.exe
+# RUN:   /entry:__ImageBase /linkrepro:repro.tar /out:%t.exe
 # RUN: tar xf repro.tar
 # RUN: diff %p/Inputs/resource.res repro/%:p/Inputs/resource.res
 # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt
Index: lld/trunk/test/COFF/linkrepro.test
===================================================================
--- lld/trunk/test/COFF/linkrepro.test
+++ lld/trunk/test/COFF/linkrepro.test
@@ -6,7 +6,7 @@
 
 # RUN: cd %t.dir/build1
 # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \
-# RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
+# RUN:   /entry:main at 0 /linkrepro:repro.tar /out:%t.exe
 # RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib
@@ -14,7 +14,7 @@
 
 # RUN: cd %t.dir/build2
 # RUN: lld-link %t.obj /libpath:%p/Inputs /defaultlib:std32 /subsystem:console \
-# RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
+# RUN:   /entry:main at 0 /linkrepro:repro.tar /out:%t.exe
 # RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib
@@ -22,7 +22,7 @@
 
 # RUN: cd %t.dir/build3
 # RUN: env LIB=%p/Inputs lld-link %t.obj /defaultlib:std32 /subsystem:console \
-# RUN:   /entry:main at 0 /linkrepro:. /out:%t.exe
+# RUN:   /entry:main at 0 /linkrepro:repro.tar /out:%t.exe
 # RUN: tar xf repro.tar
 # RUN: diff %t.obj repro/%:t.obj
 # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67461.219885.patch
Type: text/x-patch
Size: 3388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190912/c97f8016/attachment.bin>


More information about the llvm-commits mailing list