llvm-project/compiler-rt/test/orc/lit.cfg.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.7 KiB
Python
Raw Normal View History

# -*- Python -*-
import os
# Setup config name.
config.name = 'ORC' + config.name_suffix
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
def build_invocation(compile_flags):
return ' ' + ' '.join([config.clang] + compile_flags) + ' '
# Assume that llvm-jitlink is in the config.llvm_tools_dir.
llvm_jitlink = os.path.join(config.llvm_tools_dir, 'llvm-jitlink')
lli = os.path.join(config.llvm_tools_dir, 'lli')
if config.host_os == 'Darwin':
orc_rt_path = '%s/libclang_rt.orc_osx.a' % config.compiler_rt_libdir
else:
orc_rt_path = '%s/libclang_rt.orc%s.a' % (config.compiler_rt_libdir, config.target_suffix)
if config.libunwind_shared:
config.available_features.add('libunwind-available')
shared_libunwind_path = os.path.join(config.libunwind_install_dir, 'libunwind.so')
config.substitutions.append( ("%shared_libunwind", shared_libunwind_path) )
config.substitutions.append(
('%clang ', build_invocation([config.target_cflags])))
config.substitutions.append(
('%clangxx ',
build_invocation(config.cxx_mode_flags + [config.target_cflags])))
if config.host_os == 'Windows':
config.substitutions.append(
('%llvm_jitlink', (llvm_jitlink + ' -orc-runtime=' +
orc_rt_path + ' -no-process-syms=true -slab-allocate=64MB')))
else:
config.substitutions.append(
('%llvm_jitlink', (llvm_jitlink + ' -orc-runtime=' + orc_rt_path)))
config.substitutions.append(
('%lli_orc_jitlink', (lli + ' -jit-kind=orc -jit-linker=jitlink -orc-runtime=' + orc_rt_path)))
# Default test suffixes.
config.suffixes = ['.c', '.cpp', '.S', '.ll']
[ORC][ORC-RT] Rewrite the MachO platform to use allocation actions. This patch updates the MachO platform (both the ORC MachOPlatform class and the ORC-Runtime macho_platform.* files) to use allocation actions, rather than EPC calls, to transfer the initializer information scraped from each linked object. Interactions between the ORC and ORC-Runtime sides of the platform are substantially redesigned to accomodate the change. The high-level changes in this patch are: 1. The MachOPlatform::setupJITDylib method now calls into the runtime to set up a dylib name <-> header mapping, and a dylib state object (JITDylibState). 2. The MachOPlatformPlugin builds an allocation action that calls the __orc_rt_macho_register_object_platform_sections and __orc_rt_macho_deregister_object_platform_sections functions in the runtime to register the address ranges for all "interesting" sections in the object being allocated (TLS data sections, initializers, language runtime metadata sections, etc.). 3. The MachOPlatform::rt_getInitializers method (the entry point in the controller for requests from the runtime for initializer information) is replaced by MachOPlatform::rt_pushInitializers. The former returned a data structure containing the "interesting" section address ranges, but these are now handled by __orc_rt_macho_register_object_platform_sections. The new rt_pushInitializers method first issues a lookup to trigger materialization of the "interesting" sections, then returns the dylib dependence tree rooted at the requested dylib for dlopen to consume. (The dylib dependence tree is returned by rt_pushInitializers, rather than being handled by some dedicated call, because rt_pushInitializers can alter the dependence tree). The advantage of these changes (beyond the performance advantages of using allocation actions) is that it moves more information about the materialized portions of the JITDylib into the executor. This tends to make the runtime easier to reason about, e.g. the implementation of dlopen in the runtime is now recursive, rather than relying on recursive calls in the controller to build a linear data structure for consumption by the runtime. This change can also make some operations more efficient, e.g. JITDylibs can be dlclosed and then re-dlopened without having to pull all initializers over from the controller again. In addition to the high-level changes, there are some low-level changes to ORC and the runtime: * In ORC, at ExecutionSession teardown time JITDylibs are now destroyed in reverse creation order. This is on the assumption that the ORC runtime will be loaded into an earlier dylib that will be used by later JITDylibs. This is a short-term solution to crashes that arose during testing when the runtime was torn down before its users. Longer term we will likely destroy dylibs in dependence order. * toSPSSerializable(Expected<T> E) is updated to explicitly initialize the T value, allowing it to be used by Ts that have explicit constructors. * The ORC runtime now (1) attempts to track ref-counts, and (2) distinguishes not-yet-processed "interesting" sections from previously processed ones. (1) is necessary for standard dlopen/dlclose emulation. (2) is intended as a step towards better REPL support -- it should enable future runtime calls that run only newly registered initializers ("dlopen_more", "dlopen_additions", ...?).
2022-02-08 13:31:17 +08:00
# Exclude Inputs directories.
config.excludes = ['Inputs']
if config.host_os not in ['Darwin', 'FreeBSD', 'Linux', 'Windows']:
config.unsupported = True