test: Make a start on a test suite for libLTO.
[oota-llvm.git] / test / lit.cfg
index d34ca69a6890d473857ff535b12534af0d0bf318..173d51bdf805358c8c40fd0d4161137368380d26 100644 (file)
@@ -188,6 +188,7 @@ config.substitutions.append( ('%llc_dwarf', llc_dwarf) )
 
 # Add site-specific substitutions.
 config.substitutions.append( ('%gold', config.gold_executable) )
+config.substitutions.append( ('%ld64', config.ld64_executable) )
 config.substitutions.append( ('%go', config.go_executable) )
 config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
 config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
@@ -369,6 +370,22 @@ def have_ld_plugin_support():
 if have_ld_plugin_support():
     config.available_features.add('ld_plugin')
 
+def have_ld64_plugin_support():
+    if config.ld64_executable == '':
+        return False
+
+    ld_cmd = subprocess.Popen([config.ld64_executable, '-v'], stderr = subprocess.PIPE)
+    ld_out = ld_cmd.stderr.read().decode()
+    ld_cmd.wait()
+
+    if 'ld64' not in ld_out or 'LTO' not in ld_out:
+        return False
+
+    return True
+
+if have_ld64_plugin_support():
+    config.available_features.add('ld64_plugin')
+
 # Ask llvm-config about assertion mode.
 try:
     llvm_config_cmd = subprocess.Popen(