def use_support_substitutions(config): # Set up substitutions for support tools. These tools can be overridden at the CMake # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use # the just-built version. host_flags = ['--target=' + config.host_triple] if platform.system() in ['Darwin']: try: out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() res = 0 except OSError: res = -1 if res == 0 and out: sdk_path = lit.util.to_string(out) llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) host_flags += ['-isysroot', sdk_path] elif platform.system() in ['NetBSD', 'OpenBSD', 'Linux']: host_flags += ['-pthread'] if sys.platform.startswith('netbsd'): # needed e.g. to use freshly built libc++ host_flags += [ '-L' + config.llvm_libs_dir, '-Wl,-rpath,' + config.llvm_libs_dir ] # The clang module cache is used for building inferiors. host_flags += ['-fmodules-cache-path={}'.format(config.clang_module_cache)] host_flags = ' '.join(host_flags) config.substitutions.append(('%clang_host', '%clang ' + host_flags)) config.substitutions.append(('%clangxx_host', '%clangxx ' + host_flags)) config.substitutions.append( ('%clang_cl_host', '%clang_cl --target=' + config.host_triple)) additional_tool_dirs = [] if config.lldb_lit_tools_dir: additional_tool_dirs.append(config.lldb_lit_tools_dir) llvm_config.use_clang(additional_flags=[ '--target=specify-a-target-or-use-a-_host-substitution' ], additional_tool_dirs=additional_tool_dirs, required=True) if sys.platform == 'win32': _use_msvc_substitutions(config) have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, required=False) if have_lld: config.available_features.add('lld') support_tools = [ 'yaml2obj', 'obj2yaml', 'llvm-dwp', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', 'llvm-objcopy', 'lli' ] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) _disallow(config, 'clang')
def use_support_substitutions(config): # Set up substitutions for support tools. These tools can be overridden at the CMake # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use # the just-built version. flags = [] if platform.system() in ['Darwin']: try: out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() res = 0 except OSError: res = -1 if res == 0 and out: sdk_path = lit.util.to_string(out) llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) flags = ['-isysroot', sdk_path] elif platform.system() in ['NetBSD', 'OpenBSD', 'Linux']: flags = ['-pthread'] if sys.platform.startswith('netbsd'): # needed e.g. to use freshly built libc++ flags += [ '-L' + config.llvm_libs_dir, '-Wl,-rpath,' + config.llvm_libs_dir ] additional_tool_dirs = [] if config.lldb_lit_tools_dir: additional_tool_dirs.append(config.lldb_lit_tools_dir) llvm_config.use_clang(additional_flags=flags, additional_tool_dirs=additional_tool_dirs, required=True) if sys.platform == 'win32': _use_msvc_substitutions(config) have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, required=False) if have_lld: config.available_features.add('lld') support_tools = [ 'yaml2obj', 'obj2yaml', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', 'llvm-objcopy', 'lli' ] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
def use_support_substitutions(config): # Set up substitutions for support tools. These tools can be overridden at the CMake # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use # the just-built version. flags = [] if platform.system() in ['Darwin']: try: out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() res = 0 except OSError: res = -1 if res == 0 and out: sdk_path = lit.util.to_string(out) llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) flags = ['-isysroot', sdk_path] elif platform.system() in ['NetBSD', 'OpenBSD', 'Linux']: flags = ['-pthread'] if sys.platform.startswith('netbsd'): # needed e.g. to use freshly built libc++ flags += ['-L' + config.llvm_libs_dir, '-Wl,-rpath,' + config.llvm_libs_dir] additional_tool_dirs=[] if config.lldb_lit_tools_dir: additional_tool_dirs.append(config.lldb_lit_tools_dir) llvm_config.use_clang(additional_flags=flags, additional_tool_dirs=additional_tool_dirs, required=True) if sys.platform == 'win32': _use_msvc_substitutions(config) have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, required=False) if have_lld: config.available_features.add('lld') support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', 'llvm-objcopy'] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
# suffixes: A list of file extensions to treat as test files. config.suffixes = ['.ll', '.s', '.test', '.yaml', '.objtxt'] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent # directories. config.excludes = ['Inputs'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) config.test_exec_root = os.path.join(config.lld_obj_root, 'test') llvm_config.use_default_substitutions() llvm_config.use_lld() tool_patterns = [ 'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump', 'llvm-pdbutil', 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj', 'llvm-strip', 'obj2yaml', 'yaml2obj', 'opt', 'llvm-dis'] llvm_config.add_tool_substitutions(tool_patterns) # When running under valgrind, we mangle '-vg' onto the end of the triple so we # can check it with XFAIL and XTARGET. if lit_config.useValgrind: config.target_triple += '-vg' # Running on ELF based *nix
llvm_config.with_system_environment(['LIB', 'LIBPATH', 'INCLUDE']) # Clear _NT_SYMBOL_PATH to prevent cdb from attempting to load symbols from # the network. llvm_config.with_environment('_NT_SYMBOL_PATH', '') tools.append(ToolSubst('%cdb', '"%s"' % os.path.join(win_sdk, 'Debuggers', arch, 'cdb.exe'))) # clang_src_dir and lld_src_dir are not used by these tests, but are required by # use_clang() and use_lld() respectively, so set them to "", if needed. if not hasattr(config, 'clang_src_dir'): config.clang_src_dir = "" llvm_config.use_clang(required=('clang' in config.llvm_enabled_projects)) if not hasattr(config, 'lld_src_dir'): config.lld_src_dir = "" llvm_config.use_lld(required=('lld' in config.llvm_enabled_projects)) if config.llvm_use_sanitizer: # Propagate path to symbolizer for ASan/MSan. llvm_config.with_system_environment( ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) def add_host_triple(clang): return '{} --target={}'.format(clang, config.host_triple) # The set of arches we can build. targets = set(config.targets_to_build) # Add aliases to the target set. if 'AArch64' in targets: targets.add('arm64') if 'ARM' in config.targets_to_build:
def use_support_substitutions(config): # Set up substitutions for support tools. These tools can be overridden at the CMake # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use # the just-built version. host_flags = ['--target=' + config.host_triple] if platform.system() in ['Darwin']: try: out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() res = 0 except OSError: res = -1 if res == 0 and out: sdk_path = lit.util.to_string(out) llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) host_flags += ['-isysroot', sdk_path] elif platform.system() in ['NetBSD', 'OpenBSD', 'Linux']: host_flags += ['-pthread'] config.target_shared_library_suffix = '.dylib' if platform.system() in [ 'Darwin' ] else '.so' config.substitutions.append( ('%target-shared-library-suffix', config.target_shared_library_suffix)) # Swift support swift_args = [ '-module-cache-path', os.path.join(os.path.dirname(config.lldb_libs_dir), 'lldb-test-build.noindex', 'module-cache-clang') ] swift_driver_args = [] if platform.system() in ['Darwin']: swift_args += ['-sdk', sdk_path] tools = [ ToolSubst('%target-swiftc', command=config.swiftc, extra_args=swift_args + swift_driver_args), ToolSubst('%target-swift-frontend', command=config.swiftc[:-1], extra_args=(['-frontend'] + swift_args)) ] llvm_config.add_tool_substitutions(tools) swift_bin_dir = os.path.dirname(config.swiftc) swift_Benchmark_Onone = os.path.join( swift_bin_dir, 'Benchmark_Onone-{0}'.format(config.target_triple)) if os.path.exists(swift_Benchmark_Onone): config.substitutions.append( ('%swift_Benchmark_Onone', swift_Benchmark_Onone)) config.available_features.add('swift_Benchmark_Onone') if sys.platform.startswith('netbsd'): # needed e.g. to use freshly built libc++ host_flags += [ '-L' + config.llvm_libs_dir, '-Wl,-rpath,' + config.llvm_libs_dir ] # The clang module cache is used for building inferiors. host_flags += ['-fmodules-cache-path={}'.format(config.clang_module_cache)] host_flags = ' '.join(host_flags) config.substitutions.append(('%clang_host', '%clang ' + host_flags)) config.substitutions.append(('%clangxx_host', '%clangxx ' + host_flags)) config.substitutions.append( ('%clang_cl_host', '%clang_cl --target=' + config.host_triple)) additional_tool_dirs = [] if config.lldb_lit_tools_dir: additional_tool_dirs.append(config.lldb_lit_tools_dir) llvm_config.use_clang(additional_flags=[ '--target=specify-a-target-or-use-a-_host-substitution' ], additional_tool_dirs=additional_tool_dirs, required=True) if sys.platform == 'win32': _use_msvc_substitutions(config) have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, required=False) if have_lld: config.available_features.add('lld') support_tools = [ 'yaml2obj', 'obj2yaml', 'llvm-dwp', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', 'llvm-objcopy', 'lli' ] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) _disallow(config, 'clang')
def use_support_substitutions(config): # Set up substitutions for support tools. These tools can be overridden at the CMake # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use # the just-built version. flags = [] if platform.system() in ['Darwin']: try: out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() res = 0 except OSError: res = -1 if res == 0 and out: sdk_path = lit.util.to_string(out) llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) flags = ['-isysroot', sdk_path] elif platform.system() in ['OpenBSD', 'Linux']: flags = ['-pthread'] config.target_shared_library_suffix = '.dylib' if platform.system() in [ 'Darwin' ] else '.so' config.substitutions.append( ('%target-shared-library-suffix', config.target_shared_library_suffix)) # Swift support swift_args = [ '-module-cache-path', os.path.join(os.path.dirname(config.lldb_libs_dir), 'lldb-test-build.noindex', 'module-cache-clang') ] if platform.system() in ['Darwin']: swift_args += ['-sdk', sdk_path] tools = [ ToolSubst('%target-swiftc', command=config.swiftc, extra_args=swift_args), ToolSubst('%target-swift-frontend', command=config.swiftc[:-1], extra_args=(['-frontend'] + swift_args)) ] llvm_config.add_tool_substitutions(tools) additional_tool_dirs = [] if config.lldb_lit_tools_dir: additional_tool_dirs.append(config.lldb_lit_tools_dir) llvm_config.use_clang(additional_flags=flags, additional_tool_dirs=additional_tool_dirs, required=True) if sys.platform == 'win32': _use_msvc_substitutions(config) have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, required=False) if have_lld: config.available_features.add('lld') support_tools = [ 'yaml2obj', 'obj2yaml', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', 'llvm-objcopy' ] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs)
# suffixes: A list of file extensions to treat as test files. config.suffixes = ['.ll', '.s', '.test', '.yaml', '.objtxt'] # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent # directories. config.excludes = ['Inputs'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) config.test_exec_root = os.path.join(config.lld_obj_root, 'test') llvm_config.use_default_substitutions() llvm_config.use_lld() tool_patterns = [ 'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump', 'llvm-pdbutil', 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj', 'obj2yaml', 'yaml2obj', 'opt', 'llvm-dis'] llvm_config.add_tool_substitutions(tool_patterns) # When running under valgrind, we mangle '-vg' onto the end of the triple so we # can check it with XFAIL and XTARGET. if lit_config.useValgrind: config.target_triple += '-vg' # Running on ELF based *nix if platform.system() in ['FreeBSD', 'Linux']: