diff options
author | Chris Matthews <cmatthews5@apple.com> | 2018-06-26 22:33:41 +0000 |
---|---|---|
committer | Chris Matthews <cmatthews5@apple.com> | 2018-06-26 22:33:41 +0000 |
commit | 857d69412cdd5787ad24eaadb0fa277430301c74 (patch) | |
tree | 0247088ac0f984cd8f0f19f8092e36fb4ad33a70 | |
parent | 3b0743b7981ee36ababe6444a8d3383c9d4f08da (diff) |
replace fragile version check with a better fragile version check
At least on Apple platforms it is not always the case that you
can compile this return 0 app without some flags relating to targets
etc, which we have no clue about this early in startup.
Printing the ld version directly fails because ld as invoked by clang
still tries to link and can't find main. However, we can fix that by
passing -dynamiclib so it does not look for main.
git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@335679 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lnt/testing/util/compilers.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/lnt/testing/util/compilers.py b/lnt/testing/util/compilers.py index c672f2d..d79cff2 100644 --- a/lnt/testing/util/compilers.py +++ b/lnt/testing/util/compilers.py @@ -43,17 +43,8 @@ def get_cc_info(path, cc_flags=[]): cc_as_version = "Clang built in." # Determine the linker version, as found by the compiler. - tf = tempfile.NamedTemporaryFile(suffix='.c') - name = tf.name - tf.close() - tf = open(name, 'w') - print >>tf, "int main() { return 0; }" - tf.close() - cc_ld_version = capture(([cc, "-Wl,-v", '-o', '/dev/null'] + - cc_flags + [tf.name]), + cc_ld_version = capture(([cc, "-Wl,-v", "-dynamiclib"]), include_stderr=True).strip() - rm_f(tf.name) - # Extract the default target .ll (or assembly, for non-LLVM compilers). cc_target_assembly = capture([cc, '-S', '-flto', '-o', '-'] + cc_flags + ['-x', 'c', '/dev/null'], |