Skip to content

Commit e31804d

Browse files
committed
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
1 parent d446349 commit e31804d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lldb/lit/helper/build.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,17 @@ def __init__(self, toolchain_type, args):
283283
print('Using alternate compiler "{0}" to match selected target.'.format(self.compiler))
284284

285285
if self.mode == 'link' or self.mode == 'compile-and-link':
286-
self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link')
286+
self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link', args.tools_dir)
287287
if not self.linker:
288288
raise ValueError('Unable to find an appropriate linker.')
289289

290290
self.compile_env, self.link_env = self._get_visual_studio_environment()
291291

292-
def _find_linker(self, name):
293-
if sys.platform == 'win32':
294-
name = name + '.exe'
292+
def _find_linker(self, name, search_paths=[]):
295293
compiler_dir = os.path.dirname(self.compiler)
296-
linker_path = os.path.join(compiler_dir, name)
297-
if not os.path.exists(linker_path):
298-
raise ValueError('Could not find \'{}\''.format(linker_path))
294+
linker_path = find_executable(name, [compiler_dir] + search_paths)
295+
if linker_path is None:
296+
raise ValueError('Could not find \'{}\''.format(name))
299297
return linker_path
300298

301299
def _get_vc_install_dir(self):

0 commit comments

Comments
 (0)