Index: clang/test/CMakeLists.txt =================================================================== --- clang/test/CMakeLists.txt +++ clang/test/CMakeLists.txt @@ -9,6 +9,12 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) +if("lld" IN_LIST LLVM_ENABLE_PROJECTS) + set(CLANG_TEST_HAS_LLD On) +else() + set(CLANG_TEST_HAS_LLD Off) +endif() + llvm_canonicalize_cmake_booleans( CLANG_BUILD_EXAMPLES CLANG_DEFAULT_PIE_ON_LINUX @@ -22,6 +28,7 @@ LLVM_ENABLE_PER_TARGET_RUNTIME_DIR LLVM_ENABLE_THREADS LLVM_WITH_Z3 + CLANG_TEST_HAS_LLD ) configure_lit_site_cfg( @@ -145,6 +152,10 @@ endif() endif() +if(CLANG_TEST_HAS_LLD) + list(APPEND CLANG_TEST_DEPS lld) +endif() + if(CLANG_ENABLE_STATIC_ANALYZER) if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them list(APPEND CLANG_TEST_DEPS Index: clang/test/Driver/clang-with-lld.c =================================================================== --- /dev/null +++ clang/test/Driver/clang-with-lld.c @@ -0,0 +1,7 @@ +// REQUIRES: using-lld + +// Force x86_64-unknown-linux-gnu to get ld.lld flavor +// RUN: %clang -target x86_64-unknown-linux-gnu %s -fuse-ld=lld -### 2>&1 | FileCheck %s -DBIN_DIR=%bin_dir +// CHECK: [[BIN_DIR]]/ld.lld + +int main() {} Index: clang/test/lit.cfg.py =================================================================== --- clang/test/lit.cfg.py +++ clang/test/lit.cfg.py @@ -118,6 +118,7 @@ config.substitutions.append(('%host_cc', config.host_cc)) config.substitutions.append(('%host_cxx', config.host_cxx)) +config.substitutions.append(('%bin_dir', config.llvm_bin_dir)) # Plugins (loadable modules) if config.has_plugins and config.llvm_plugin_ext: @@ -131,6 +132,9 @@ if config.clang_default_cxx_stdlib != '': config.available_features.add('default-cxx-stdlib-set') +if config.clang_using_lld: + config.available_features.add('using-lld') + # As of 2011.08, crash-recovery tests still do not pass on FreeBSD. if platform.system() not in ['FreeBSD']: config.available_features.add('crash-recovery') Index: clang/test/lit.site.cfg.py.in =================================================================== --- clang/test/lit.site.cfg.py.in +++ clang/test/lit.site.cfg.py.in @@ -6,6 +6,7 @@ config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@") config.llvm_tools_dir = path(r"@LLVM_TOOLS_DIR@") config.llvm_libs_dir = path(r"@LLVM_LIBS_DIR@") +config.llvm_bin_dir = path(r"@CMAKE_RUNTIME_OUTPUT_DIRECTORY@") config.llvm_shlib_dir = path(r"@SHLIBDIR@") config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@" config.lit_tools_dir = path(r"@LLVM_LIT_TOOLS_DIR@") @@ -37,6 +38,7 @@ config.has_plugins = @CLANG_PLUGIN_SUPPORT@ config.clang_vendor_uti = "@CLANG_VENDOR_UTI@" config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@") +config.clang_using_lld = @CLANG_TEST_HAS_LLD@ # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time.