[lld] r274622 - Use / instead of \ on windows created cpio files

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 05:09:51 PDT 2016


Author: rafael
Date: Wed Jul  6 07:09:51 2016
New Revision: 274622

URL: http://llvm.org/viewvc/llvm-project?rev=274622&view=rev
Log:
Use / instead of \ on windows created cpio files

Otherwise when extracting these files on a unix system one
ends up with files named like "repro\bar\foo.o".

Modified:
    lld/trunk/ELF/DriverUtils.cpp
    lld/trunk/test/ELF/reproduce-windows.s

Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=274622&r1=274621&r2=274622&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Wed Jul  6 07:09:51 2016
@@ -152,6 +152,11 @@ void CpioFile::append(StringRef Path, St
   // (i.e. in that case we are creating baz.cpio.)
   SmallString<128> Fullpath;
   path::append(Fullpath, Basename, Path);
+
+  // Use unix path separators so the cpio can be extracted on both unix and
+  // windows.
+  std::replace(Fullpath.begin(), Fullpath.end(), '\\', '/');
+
   writeMember(*OS, Fullpath, Data);
 
   // Print the trailer and seek back.

Modified: lld/trunk/test/ELF/reproduce-windows.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-windows.s?rev=274622&r1=274621&r2=274622&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-windows.s (original)
+++ lld/trunk/test/ELF/reproduce-windows.s Wed Jul  6 07:09:51 2016
@@ -6,5 +6,7 @@
 # RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux
 # RUN: cd %t.dir
 # RUN: not ld.lld build/foo.o --reproduce repro
-# RUN: cpio -t < repro.cpio | grep -F 'repro\response.txt'
-# RUN: cpio -t < repro.cpio | grep -F 'repro\%:t.dir\build\foo.o'
+# RUN: cpio -t < repro.cpio | FileCheck %s
+
+# CHECK: repro/response.txt
+# CHECK: repro/{{.*}}/build/foo.o




More information about the llvm-commits mailing list