[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / profile / Linux / lit.local.cfg.py
blob98d79518b92aaf8c8beab24cdfefed5efce8a00c
1 import subprocess
3 def getRoot(config):
4 if not config.parent:
5 return config
6 return getRoot(config.parent)
9 def is_gold_linker_available():
11 if not config.gold_executable:
12 return False
13 try:
14 ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
15 ld_out = ld_cmd.stdout.read().decode()
16 ld_cmd.wait()
17 except:
18 return False
20 if not '-plugin' in ld_out:
21 return False
23 # config.clang is not guaranteed to be just the executable!
24 clang_cmd = subprocess.Popen(" ".join([config.clang, '-fuse-ld=gold', '-xc', '-']),
25 shell=True,
26 universal_newlines = True,
27 stdin = subprocess.PIPE,
28 stdout = subprocess.PIPE,
29 stderr = subprocess.PIPE)
30 clang_err = clang_cmd.communicate('int main() { return 0; }')[1]
32 if not 'invalid linker' in clang_err:
33 return True
35 return False
37 root = getRoot(config)
39 if root.host_os not in ['Linux'] or not is_gold_linker_available():
40 config.unsupported = True