[LNT] r335679 - replace fragile version check with a better fragile version check

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 15:33:41 PDT 2018


Author: cmatthews
Date: Tue Jun 26 15:33:41 2018
New Revision: 335679

URL: http://llvm.org/viewvc/llvm-project?rev=335679&view=rev
Log:
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.

Modified:
    lnt/trunk/lnt/testing/util/compilers.py

Modified: lnt/trunk/lnt/testing/util/compilers.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/util/compilers.py?rev=335679&r1=335678&r2=335679&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/util/compilers.py (original)
+++ lnt/trunk/lnt/testing/util/compilers.py Tue Jun 26 15:33:41 2018
@@ -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'],




More information about the llvm-commits mailing list