<div dir="ltr">Note that the commit message is the opposite to what this patch does. It replaces backslashes with forward slashes.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 5:23 AM, George Rimar via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: grimar<br>
Date: Fri Nov 11 07:23:13 2016<br>
New Revision: 286589<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286589&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=286589&view=rev</a><br>
Log:<br>
[ELF] - Use backward slashes inside response files<br>
<br>
Patch replaces forward slashes with backward inside response.txt<br>
<br>
This is <a href="https://llvm.org/bugs/show_bug.cgi?id=30951" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_<wbr>bug.cgi?id=30951</a>.<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D26443" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D26443</a><br>
<br>
Added:<br>
    lld/trunk/test/ELF/reproduce-<wbr>windows2.s<br>
Modified:<br>
    lld/trunk/lib/Core/Reproduce.<wbr>cpp<br>
    lld/trunk/test/lit.cfg<br>
<br>
Modified: lld/trunk/lib/Core/Reproduce.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Reproduce.cpp?rev=286589&r1=286588&r2=286589&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/lib/Core/<wbr>Reproduce.cpp?rev=286589&r1=<wbr>286588&r2=286589&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/lib/Core/Reproduce.<wbr>cpp (original)<br>
+++ lld/trunk/lib/Core/Reproduce.<wbr>cpp Fri Nov 11 07:23:13 2016<br>
@@ -50,6 +50,12 @@ static void writeMember(raw_fd_ostream &<br>
   OS << Data;                            // c_filedata<br>
 }<br>
<br>
+// Converts path to use unix path separators so the cpio can be extracted on<br>
+// both unix and windows.<br>
+static void convertToUnixPathSeparator(<wbr>SmallString<128> &Path) {<br>
+  std::replace(Path.begin(), Path.end(), '\\', '/');<br>
+}<br>
+<br>
 void CpioFile::append(StringRef Path, StringRef Data) {<br>
   if (!Seen.insert(Path).second)<br>
     return;<br>
@@ -59,10 +65,7 @@ void CpioFile::append(StringRef Path, St<br>
   // (i.e. in that case we are creating baz.cpio.)<br>
   SmallString<128> Fullpath;<br>
   path::append(Fullpath, Basename, Path);<br>
-<br>
-  // Use unix path separators so the cpio can be extracted on both unix and<br>
-  // windows.<br>
-  std::replace(Fullpath.begin(), Fullpath.end(), '\\', '/');<br>
+  convertToUnixPathSeparator(<wbr>Fullpath);<br>
<br>
   writeMember(*OS, Fullpath, Data);<br>
<br>
@@ -76,6 +79,8 @@ void CpioFile::append(StringRef Path, St<br>
 // Makes a given pathname an absolute path first, and then remove<br>
 // beginning /. For example, "../foo.o" is converted to "home/john/foo.o",<br>
 // assuming that the current directory is "/home/john/bar".<br>
+// Returned string is a backslash-separated path even on Windows to avoid<br>
+// a mess with backslash-as-escape and backslash-as-path-separator.<br>
 std::string lld::relativeToRoot(StringRef Path) {<br>
   SmallString<128> Abs = Path;<br>
   if (sys::fs::make_absolute(Abs))<br>
@@ -93,6 +98,7 @@ std::string lld::relativeToRoot(StringRe<br>
     Res = Root.substr(2);<br>
<br>
   path::append(Res, path::relative_path(Abs));<br>
+  convertToUnixPathSeparator(<wbr>Res);<br>
<br>
   return Res.str();<br>
 }<br>
<br>
Added: lld/trunk/test/ELF/reproduce-<wbr>windows2.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-windows2.s?rev=286589&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>reproduce-windows2.s?rev=<wbr>286589&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/reproduce-<wbr>windows2.s (added)<br>
+++ lld/trunk/test/ELF/reproduce-<wbr>windows2.s Fri Nov 11 07:23:13 2016<br>
@@ -0,0 +1,11 @@<br>
+# REQUIRES: system-windows, x86, cpio<br>
+<br>
+# Test that a response.txt file always uses / instead of \.<br>
+# RUN: rm -rf %t.dir<br>
+# RUN: mkdir -p %t.dir/build<br>
+# RUN: llvm-mc %s -o %t.dir/build/foo.o -filetype=obj -triple=x86_64-pc-linux<br>
+# RUN: cd %t.dir<br>
+# RUN: ld.lld build/foo.o --reproduce repro<br>
+# RUN: echo "*response.txt" > list.txt<br>
+# RUN: cpio -i --to-stdout --pattern-file=list.txt < repro.cpio | FileCheck %s<br>
+# CHECK: {{.*}}/build/foo.o<br>
<br>
Modified: lld/trunk/test/lit.cfg<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=286589&r1=286588&r2=286589&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/lit.<wbr>cfg?rev=286589&r1=286588&r2=<wbr>286589&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/lit.cfg (original)<br>
+++ lld/trunk/test/lit.cfg Fri Nov 11 07:23:13 2016<br>
@@ -207,6 +207,10 @@ if platform.system() in ['Darwin']:<br>
 if platform.system() in ['FreeBSD', 'Linux']:<br>
     config.available_features.add(<wbr>'system-linker-elf')<br>
<br>
+# Running on Windows<br>
+if platform.system() in ['Windows']:<br>
+    config.available_features.add(<wbr>'system-windows')<br>
+<br>
 # Set if host-cxxabi's demangler can handle target's symbols.<br>
 if platform.system() not in ['Windows']:<br>
     config.available_features.add(<wbr>'demangler')<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>