diff options
author | Tom Stellard <tstellar@redhat.com> | 2019-05-29 19:31:21 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2019-05-29 19:31:21 +0000 |
commit | e31804dc85d2b3f6718a1b010be7c5272a1f9045 (patch) | |
tree | b32b1a10e553530c053a84f0ddf09db58adc6810 | |
parent | d44634951a4dc5577a271da591a1e189d5960375 (diff) | |
download | llvm-e31804dc85d2b3f6718a1b010be7c5272a1f9045.zip llvm-e31804dc85d2b3f6718a1b010be7c5272a1f9045.tar.gz llvm-e31804dc85d2b3f6718a1b010be7c5272a1f9045.tar.bz2 |
Merging r353701:
------------------------------------------------------------------------
r353701 | mgorny | 2019-02-11 06:09:48 -0800 (Mon, 11 Feb 2019) | 8 lines
[lldb] [lit] Fix finding lld-link when it is not in 'compiler dir'
Fix the build helper to find lld-link via PATH lookup, rather than
making a fragile assumption that it will be present in the 'compiler
directory'. This fixes tests on Gentoo where clang and lld
are installed in different directories.
Differential Revision: https://reviews.llvm.org/D58001
------------------------------------------------------------------------
llvm-svn: 362017
-rwxr-xr-x | lldb/lit/helper/build.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lldb/lit/helper/build.py b/lldb/lit/helper/build.py index 26f321d..fd52b7d 100755 --- a/lldb/lit/helper/build.py +++ b/lldb/lit/helper/build.py @@ -283,19 +283,17 @@ class MsvcBuilder(Builder): print('Using alternate compiler "{0}" to match selected target.'.format(self.compiler)) if self.mode == 'link' or self.mode == 'compile-and-link': - self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link') + self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link', args.tools_dir) if not self.linker: raise ValueError('Unable to find an appropriate linker.') self.compile_env, self.link_env = self._get_visual_studio_environment() - def _find_linker(self, name): - if sys.platform == 'win32': - name = name + '.exe' + def _find_linker(self, name, search_paths=[]): compiler_dir = os.path.dirname(self.compiler) - linker_path = os.path.join(compiler_dir, name) - if not os.path.exists(linker_path): - raise ValueError('Could not find \'{}\''.format(linker_path)) + linker_path = find_executable(name, [compiler_dir] + search_paths) + if linker_path is None: + raise ValueError('Could not find \'{}\''.format(name)) return linker_path def _get_vc_install_dir(self): |