1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[lld] Add a feature for each lld variant when use_lld is called

This allows tests to detect whether to run or not, dependent on which
LLD version is required for the test.

Reviewed by: thopre

Differential Revision: https://reviews.llvm.org/D101997
This commit is contained in:
James Henderson 2021-05-06 15:44:46 +01:00
parent 83804e2bc6
commit 2366a60fe0
15 changed files with 36 additions and 0 deletions

View File

@ -615,11 +615,16 @@ class LLVMConfig(object):
tool_substitutions = []
if ld_lld:
tool_substitutions.append(ToolSubst(r'ld\.lld', command=ld_lld))
self.config.available_features.add('ld.lld')
if lld_link:
tool_substitutions.append(ToolSubst('lld-link', command=lld_link))
self.config.available_features.add('lld-link')
if ld64_lld:
tool_substitutions.append(ToolSubst(r'ld64\.lld', command=ld64_lld))
self.config.available_features.add('ld64.lld')
if wasm_ld:
tool_substitutions.append(ToolSubst('wasm-ld', command=wasm_ld))
self.config.available_features.add('wasm-ld')
self.add_tool_substitutions(tool_substitutions)
return was_found

View File

@ -0,0 +1,2 @@
# REQUIRES: ld.lld
# RUN: true

View File

@ -0,0 +1,2 @@
# REQUIRES: ld64.lld
# RUN: true

View File

@ -0,0 +1,17 @@
import lit.formats
config.name = 'search-env'
config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()
config.test_source_root = None
config.test_exec_root = None
config.llvm_tools_dir = ''
import lit.llvm
lit.llvm.initialize(lit_config, config)
import os.path
curdir = os.path.dirname(__file__)
# The current directory contains files for each version of LLD, both with and
# without a .exe extension. The .exe versions will be found on Windows and the
# ones without will be found on Linux. Note that all files are just empty files,
# since the test doesn't actually use them.
lit.llvm.llvm_config.with_environment('PATH', curdir, append_path=True)
lit.llvm.llvm_config.use_lld(use_installed=True)

View File

@ -0,0 +1,2 @@
# REQUIRES: lld-link
# RUN: true

View File

@ -0,0 +1,2 @@
# REQUIRES: wasm-ld
# RUN: true

View File

@ -0,0 +1,6 @@
## Show that each of the LLD variants detected by use_lld comes with its own
## feature.
# RUN: %{lit} %{inputs}/lld-features 2>&1 | FileCheck %s -DDIR=%p
# CHECK: Passed: 4