[PATCH] D47578: Do not enforce absolute path argv0 in windows
Takuto Ikuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 31 03:22:02 PDT 2018
takuto.ikuta created this revision.
takuto.ikuta added reviewers: thakis, rnk.
Herald added a subscriber: hiraditya.
Herald added a reviewer: alexshap.
Even if we support no-canonical-prefix on clang-cl(https://reviews.llvm.org/D47480), argv0 becomes absolute path in clang-cl and that embeds absolute path in /showIncludes.
This patch removes such full path normalization from InitLLVM on windows.
Also this patch revealed that some tests may use binary out of build dir.
https://reviews.llvm.org/D47578
Files:
clang/test/lit.cfg.py
lld/test/lit.cfg.py
llvm/lib/Support/Windows/Process.inc
llvm/test/lit.cfg.py
Index: llvm/test/lit.cfg.py
===================================================================
--- llvm/test/lit.cfg.py
+++ llvm/test/lit.cfg.py
@@ -142,10 +142,10 @@
tools.extend([
'dsymutil', 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as', 'llvm-bcanalyzer',
'llvm-config', 'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis',
- 'llvm-dwarfdump', 'llvm-extract', 'llvm-isel-fuzzer', 'llvm-opt-fuzzer', 'llvm-lib',
- 'llvm-link', 'llvm-lto', 'llvm-lto2', 'llvm-mc', 'llvm-mca',
- 'llvm-modextract', 'llvm-nm', 'llvm-objcopy', 'llvm-objdump',
- 'llvm-pdbutil', 'llvm-profdata', 'llvm-ranlib', 'llvm-readobj',
+ 'llvm-dlltool', 'llvm-dwarfdump', 'llvm-dwp', 'llvm-extract', 'llvm-isel-fuzzer',
+ 'llvm-opt-fuzzer', 'llvm-lib', 'llvm-link', 'llvm-lto', 'llvm-lto2', 'llvm-mc', 'llvm-mca',
+ 'llvm-modextract', 'llvm-nm', 'llvm-objcopy', 'llvm-objdump', 'llvm-opt-report',
+ 'llvm-pdbutil', 'llvm-profdata', 'llvm-ranlib', 'llvm-rc', 'llvm-readelf', 'llvm-readobj',
'llvm-rtdyld', 'llvm-size', 'llvm-split', 'llvm-strings', 'llvm-strip', 'llvm-tblgen',
'llvm-c-test', 'llvm-cxxfilt', 'llvm-xray', 'yaml2obj', 'obj2yaml',
'yaml-bench', 'verify-uselistorder',
Index: llvm/lib/Support/Windows/Process.inc
===================================================================
--- llvm/lib/Support/Windows/Process.inc
+++ llvm/lib/Support/Windows/Process.inc
@@ -235,19 +235,11 @@
return mapWindowsError(::GetLastError());
Args.reserve(ArgCount);
- std::error_code ec;
-
- // The first argument may contain just the name of the executable (e.g.,
- // "clang") rather than the full path, so swap it with the full path.
- wchar_t ModuleName[MAX_PATH];
- int Length = ::GetModuleFileNameW(NULL, ModuleName, MAX_PATH);
- if (0 < Length && Length < MAX_PATH)
- UnicodeCommandLine[0] = ModuleName;
// If the first argument is a shortened (8.3) name (which is possible even
// if we got the module name), the driver will have trouble distinguishing it
// (e.g., clang.exe v. clang++.exe), so expand it now.
- ec = ExpandShortFileName(UnicodeCommandLine[0], Args, Alloc);
+ std::error_code ec = ExpandShortFileName(UnicodeCommandLine[0], Args, Alloc);
for (int i = 1; i < ArgCount && !ec; ++i) {
ec = WildcardExpand(UnicodeCommandLine[i], Args, Alloc);
Index: lld/test/lit.cfg.py
===================================================================
--- lld/test/lit.cfg.py
+++ lld/test/lit.cfg.py
@@ -39,9 +39,12 @@
llvm_config.use_lld()
tool_patterns = [
- 'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump', 'llvm-pdbutil',
- 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj', 'obj2yaml', 'yaml2obj',
- 'opt', 'llvm-dis']
+ 'llc', 'llvm-ar', 'llvm-as', 'llvm-bcanalyzer', 'llvm-lib', 'llvm-mc', 'llvm-nm',
+ 'llvm-objdump', 'llvm-pdbutil', 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj',
+ 'obj2yaml', 'yaml2obj', 'opt', 'llvm-dis']
+
+if platform.system() == 'Windows':
+ tool_patterns += ['LLD-LINK']
llvm_config.add_tool_substitutions(tool_patterns)
Index: clang/test/lit.cfg.py
===================================================================
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -58,7 +58,8 @@
tools = [
'c-index-test', 'clang-check', 'clang-diff', 'clang-format', 'clang-tblgen',
- 'opt',
+ 'llc', 'llvm-bcanalyzer', 'llvm-dis', 'llvm-lto', 'llvm-nm', 'llvm-objdump',
+ 'llvm-profdata', 'llvm-readobj', 'opt',
ToolSubst('%clang_func_map', command=FindTool(
'clang-func-mapping'), unresolved='ignore'),
]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47578.149256.patch
Type: text/x-patch
Size: 3590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/ca6c862e/attachment.bin>
More information about the llvm-commits
mailing list