[all-commits] [llvm/llvm-project] ac5ce4: [ORC-RT] Fix signedness warning in unit test.

lhames via All-commits all-commits at lists.llvm.org
Mon Jul 19 02:58:02 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ac5ce40fa80d1ca0c25db23375b60cfbc39f5c7f
      https://github.com/llvm/llvm-project/commit/ac5ce40fa80d1ca0c25db23375b60cfbc39f5c7f
  Author: Lang Hames <lhames at gmail.com>
  Date:   2021-07-19 (Mon, 19 Jul 2021)

  Changed paths:
    M compiler-rt/lib/orc/unittests/adt_test.cpp

  Log Message:
  -----------
  [ORC-RT] Fix signedness warning in unit test.


  Commit: bb5f97e3ad10a0f8a62560890e5a87b4bc2c00bd
      https://github.com/llvm/llvm-project/commit/bb5f97e3ad10a0f8a62560890e5a87b4bc2c00bd
  Author: Lang Hames <lhames at gmail.com>
  Date:   2021-07-19 (Mon, 19 Jul 2021)

  Changed paths:
    M compiler-rt/lib/orc/CMakeLists.txt
    M compiler-rt/lib/orc/common.h
    A compiler-rt/lib/orc/executor_address.h
    A compiler-rt/lib/orc/log_error_to_stderr.cpp
    A compiler-rt/lib/orc/macho_platform.cpp
    A compiler-rt/lib/orc/macho_platform.h
    A compiler-rt/lib/orc/run_program_wrapper.cpp
    M compiler-rt/lib/orc/simple_packed_serialization.h
    M compiler-rt/lib/orc/wrapper_function_utils.h
    R compiler-rt/test/orc/TestCases/Darwin/x86-64/placeholder_test.S
    A compiler-rt/test/orc/TestCases/Darwin/x86-64/trivial-cxa-atexit.S
    A compiler-rt/test/orc/TestCases/Darwin/x86-64/trivial-static-initializer.S
    M llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
    M llvm/include/llvm/ExecutionEngine/Orc/Core.h
    M llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
    A llvm/include/llvm/ExecutionEngine/Orc/LLVMSPSSerializers.h
    M llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
    M llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
    M llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
    M llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
    M llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/OrcRPCTPCServer.h
    M llvm/lib/ExecutionEngine/Orc/Core.cpp
    M llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
    M llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
    M llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
    M llvm/tools/llvm-jitlink/llvm-jitlink.cpp
    M llvm/tools/llvm-jitlink/llvm-jitlink.h
    M llvm/unittests/ExecutionEngine/Orc/SimplePackedSerializationTest.cpp

  Log Message:
  -----------
  [ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform.

Adds support for MachO static initializers/deinitializers and eh-frame
registration via the ORC runtime.

This commit introduces cooperative support code into the ORC runtime and ORC
LLVM libraries (especially the MachOPlatform class) to support macho runtime
features for JIT'd code. This commit introduces support for static
initializers, static destructors (via cxa_atexit interposition), and eh-frame
registration. Near-future commits will add support for MachO native
thread-local variables, and language runtime registration (e.g. for Objective-C
and Swift).

The llvm-jitlink tool is updated to use the ORC runtime where available, and
regression tests for the new MachOPlatform support are added to compiler-rt.

Notable changes on the ORC runtime side:

1. The new macho_platform.h / macho_platform.cpp files contain the bulk of the
runtime-side support. This includes eh-frame registration; jit versions of
dlopen, dlsym, and dlclose; a cxa_atexit interpose to record static destructors,
and an '__orc_rt_macho_run_program' function that defines running a JIT'd MachO
program in terms of the jit- dlopen/dlsym/dlclose functions.

2. Replaces JITTargetAddress (and casting operations) with ExecutorAddress
(copied from LLVM) to improve type-safety of address management.

3. Adds serialization support for ExecutorAddress and unordered_map types to
the runtime-side Simple Packed Serialization code.

4. Adds orc-runtime regression tests to ensure that static initializers and
cxa-atexit interposes work as expected.

Notable changes on the LLVM side:

1. The MachOPlatform class is updated to:

  1.1. Load the ORC runtime into the ExecutionSession.
  1.2. Set up standard aliases for macho-specific runtime functions. E.g.
       ___cxa_atexit -> ___orc_rt_macho_cxa_atexit.
  1.3. Install the MachOPlatformPlugin to scrape LinkGraphs for information
       needed to support MachO features (e.g. eh-frames, mod-inits), and
       communicate this information to the runtime.
  1.4. Provide entry-points that the runtime can call to request initializers,
       perform symbol lookup, and request deinitialiers (the latter is
       implemented as an empty placeholder as macho object deinits are rarely
       used).
  1.5. Create a MachO header object for each JITDylib (defining the __mh_header
       and __dso_handle symbols).

2. The llvm-jitlink tool (and llvm-jitlink-executor) are updated to use the
runtime when available.

3. A `lookupInitSymbolsAsync` method is added to the Platform base class. This
can be used to issue an async lookup for initializer symbols. The existing
`lookupInitSymbols` method is retained (the GenericIRPlatform code is still
using it), but is deprecated and will be removed soon.

4. JIT-dispatch support code is added to ExecutorProcessControl.

The JIT-dispatch system allows handlers in the JIT process to be associated with
'tag' symbols in the executor, and allows the executor to make remote procedure
calls back to the JIT process (via __orc_rt_jit_dispatch) using those tags.

The primary use case is ORC runtime code that needs to call bakc to handlers in
orc::Platform subclasses. E.g. __orc_rt_macho_jit_dlopen calling back to
MachOPlatform::rt_getInitializers using __orc_rt_macho_get_initializers_tag.
(The system is generic however, and could be used by non-runtime code).

The new ExecutorProcessControl::JITDispatchInfo struct provides the address
(in the executor) of the jit-dispatch function and a jit-dispatch context
object, and implementations of the dispatch function are added to
SelfExecutorProcessControl and OrcRPCExecutorProcessControl.

5. OrcRPCTPCServer is updated to support JIT-dispatch calls over ORC-RPC.

6. Serialization support for StringMap is added to the LLVM-side Simple Packed
Serialization code.

7. A JITLink::allocateBuffer operation is introduced to allocate writable memory
attached to the graph. This is used by the MachO header synthesis code, and will
be generically useful for other clients who want to create new graph content
from scratch.


Compare: https://github.com/llvm/llvm-project/compare/fe494fafa902...bb5f97e3ad10


More information about the All-commits mailing list