Skip to content

Commit 6fd9767

Browse files
committed
Upstream LLVM 3.9.0 trunk has begun to process response files passed to llvm-link with backslash as an escape character, so always use forward slashes when passing file paths to the link on Windows.
1 parent 7cc73a0 commit 6fd9767

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/shared.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,12 @@ def consider_archive(f):
15361536

15371537
response_fh = open(response_file, 'w')
15381538
for arg in actual_files:
1539+
# Starting from LLVM 3.9.0 trunk around July 2016, LLVM escapes backslashes in response files, so Windows paths
1540+
# "c:\path\to\file.txt" with single slashes no longer work. LLVM upstream dev 3.9.0 from January 2016 still treated
1541+
# backslashes without escaping. To preserve compatibility with both versions of llvm-link, don't pass backslash
1542+
# path delimiters at all to response files, but always use forward slashes.
1543+
if WINDOWS: arg = arg.replace('\\', '/')
1544+
15391545
# escaped double quotes allows 'space' characters in pathname the response file can use
15401546
response_fh.write("\"" + arg + "\"\n")
15411547
response_fh.close()

0 commit comments

Comments
 (0)