[Lldb-commits] [PATCH] D58001: [lldb] [lit] Fix finding lld-link when it is not in 'compiler dir'

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 11 06:09:36 PST 2019


This revision was automatically updated to reflect the committed changes.
mgorny marked an inline comment as done.
Closed by commit rL353701: [lldb] [lit] Fix finding lld-link when it is not in 'compiler dir' (authored by mgorny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D58001?vs=186205&id=186242#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58001/new/

https://reviews.llvm.org/D58001

Files:
  lldb/trunk/lit/helper/build.py


Index: lldb/trunk/lit/helper/build.py
===================================================================
--- lldb/trunk/lit/helper/build.py
+++ lldb/trunk/lit/helper/build.py
@@ -283,19 +283,17 @@
                     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):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58001.186242.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190211/cdaaa81e/attachment-0001.bin>


More information about the lldb-commits mailing list