| 1 | import re |
| 2 | import subprocess |
| 3 | |
| 4 | |
| 5 | def is_gold_v1_16_linker_available(): |
| 6 | |
| 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 |
| 19 | |
| 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 |
| 27 | |
| 28 | return True |
| 29 | |
| 30 | |
| 31 | if not is_gold_v1_16_linker_available(): |
| 32 | config.unsupported = True |