[gn build] Port 3986cffe8112
[llvm-project.git] / llvm / test / tools / gold / X86 / v1.16 / lit.local.cfg
blob2b9376e68cf629aa9f31217cddce789af8208f9a
1 import re
2 import subprocess
5 def is_gold_v1_16_linker_available():
7     if not config.gold_executable:
8         return False
9     try:
10         ld_cmd = subprocess.Popen(
11             [config.gold_executable, "-v"],
12             stdout=subprocess.PIPE,
13             stderr=subprocess.PIPE,
14         )
15         ld_out, _ = ld_cmd.communicate()
16         ld_out = ld_out.decode()
17     except:
18         return False
20     match = re.search(r"GNU gold \(.*\) (\d+)\.(\d+)", ld_out)
21     if not match:
22         return False
23     major = int(match.group(1))
24     minor = int(match.group(2))
25     if major < 1 or (major == 1 and minor < 16):
26         return False
28     return True
31 if not is_gold_v1_16_linker_available():
32     config.unsupported = True