[PATCH] D91112: [compiler-rt][tests] Fix plugin support detection when no ld.gold

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 17:16:20 PST 2020


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: daltenty, jasonliu.
Herald added subscribers: Sanitizers, dberris.
Herald added a project: Sanitizers.
hubert.reinterpretcast requested review of this revision.

The plugin support detection is broken when ld.bfd supports plugins but there is no ld.gold. The script tries to call `GOLD_EXECUTABLE-NOTFOUND` and does not handle the resulting exception. This patch handles such cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91112

Files:
  compiler-rt/test/lit.common.cfg.py


Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -410,7 +410,10 @@
   # We require both ld.bfd and ld.gold exist and support plugins. They are in
   # the same repository 'binutils-gdb' and usually built together.
   for exe in (config.gnu_ld_executable, config.gold_executable):
-    ld_cmd = subprocess.Popen([exe, '--help'], stdout=subprocess.PIPE, env={'LANG': 'C'})
+    try:
+      ld_cmd = subprocess.Popen([exe, '--help'], stdout=subprocess.PIPE, env={'LANG': 'C'})
+    except FileNotFoundError as e:
+      return False
     ld_out = ld_cmd.stdout.read().decode()
     ld_cmd.wait()
     if not '-plugin' in ld_out:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91112.304017.patch
Type: text/x-patch
Size: 768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201110/928f0bc8/attachment.bin>


More information about the llvm-commits mailing list