6 return getRoot(config
.parent
)
9 def is_gold_linker_available():
11 if not config
.gold_executable
:
14 ld_cmd
= subprocess
.Popen([config
.gold_executable
, '--help'], stdout
= subprocess
.PIPE
)
15 ld_out
= ld_cmd
.stdout
.read().decode()
20 if not '-plugin' in ld_out
:
23 # config.clang is not guaranteed to be just the executable!
24 clang_cmd
= subprocess
.Popen(" ".join([config
.clang
, '-fuse-ld=gold', '-xc', '-']),
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
:
37 root
= getRoot(config
)
39 if root
.host_os
not in ['Linux'] or not is_gold_linker_available():
40 config
.unsupported
= True