33 lines · plain
1import re2import subprocess3 4 5def is_gold_v1_12_linker_available():6 7 if not config.gold_executable:8 return False9 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 False19 20 match = re.search(r"GNU gold \(.*\) (\d+)\.(\d+)", ld_out)21 if not match:22 return False23 major = int(match.group(1))24 minor = int(match.group(2))25 if major < 1 or (major == 1 and minor < 12):26 return False27 28 return True29 30 31if not is_gold_v1_12_linker_available():32 config.unsupported = True33