diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index c5a8420da14ff4..3dd258283e5ce2 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -540,9 +540,12 @@ def is_binutils_lto_supported(): # 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'}) - ld_out = ld_cmd.stdout.read().decode() - ld_cmd.wait() + try: + ld_cmd = subprocess.Popen([exe, '--help'], stdout=subprocess.PIPE, env={'LANG': 'C'}) + ld_out = ld_cmd.stdout.read().decode() + ld_cmd.wait() + except OSError: + return False if not '-plugin' in ld_out: return False