HomePhabricator

[ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform.

Authored by lhames on Jul 14 2021, 4:09 AM.

Description

[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.

  1. Replaces JITTargetAddress (and casting operations) with ExecutorAddress

(copied from LLVM) to improve type-safety of address management.

  1. Adds serialization support for ExecutorAddress and unordered_map types to

the runtime-side Simple Packed Serialization code.

  1. 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).
  1. The llvm-jitlink tool (and llvm-jitlink-executor) are updated to use the

runtime when available.

  1. 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.

  1. 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.

  1. OrcRPCTPCServer is updated to support JIT-dispatch calls over ORC-RPC.
  1. Serialization support for StringMap is added to the LLVM-side Simple Packed

Serialization code.

  1. 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.

Details

Committed
lhamesJul 19 2021, 2:50 AM
Parents
rGac5ce40fa80d: [ORC-RT] Fix signedness warning in unit test.
Branches
Unknown
Tags
Unknown

Event Timeline

Herald added a subscriber: Restricted Project. ยท View Herald TranscriptJul 19 2021, 2:58 AM

Hi @lhames,

With this commit I get compilation errors on my system. I'm not sure if there needs to be some checks in the build system to make sure header files are of some certain version or so?
Anyway, I get the following when compiling run_program_wrapper.cpp:

/repo/uabelho/master-github/llvm/build-all-bbigcc-builtins/./bin/clang++ --target=x86_64-unknown-linux-gnu  -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/repo/uabelho/master-github/compiler-rt/lib/orc/.. -I/repo/uabelho/master-github/compiler-rt/lib/orc/../../include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG    -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Werror=thread-safety -Werror=thread-safety-reference -Werror=thread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -I/repo/uabelho/master-github/llvm/build-all-bbigcc-builtins/include -I/repo/uabelho/master-github/llvm/include -UNDEBUG -MD -MT compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/run_program_wrapper.cpp.o -MF compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/run_program_wrapper.cpp.o.d -o compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/run_program_wrapper.cpp.o -c /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/error.h:14:
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:24:56: error: no template named 'index_sequence' in namespace 'std'
decltype(auto) apply_tuple_impl(F &&f, Tuple &&t, std::index_sequence<I...>) {
                                                  ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:37:24: error: no template named 'make_index_sequence' in namespace 'std'
  using Indices = std::make_index_sequence<
                  ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:41:35: error: use of undeclared identifier 'Indices'
                                  Indices{});
                                  ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:21: error: no member named 'make_unique' in namespace 'std'
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
               ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:33: error: 'ErrT' does not refer to a value
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:133:20: note: declared here
template <typename ErrT, typename... ArgTs> Error make_error(ArgTs &&...Args) {
                   ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:64: error: expected ')'
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                                               ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:38: note: to match this '('
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                     ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:192:44: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using wrap = std::reference_wrapper<std::remove_reference_t<T>>;
                                      ~~~~~^~~~~~~~~~~~~~~~~~
                                           remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:194:29: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'?
  using storage_type = std::conditional_t<IsRef, wrap, T>;
                       ~~~~~^~~~~~~~~~~~~
                            conditional
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1780:12: note: 'conditional' declared here
    struct conditional
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:197:26: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using reference = std::remove_reference_t<T> &;
                    ~~~~~^~~~~~~~~~~~~~~~~~
                         remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:198:38: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using const_reference = const std::remove_reference_t<T> &;
                                ~~~~~^~~~~~~~~~~~~~~~~~
                                     remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:199:24: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using pointer = std::remove_reference_t<T> *;
                  ~~~~~^~~~~~~~~~~~~~~~~~
                       remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:200:36: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using const_pointer = const std::remove_reference_t<T> *;
                              ~~~~~^~~~~~~~~~~~~~~~~~
                                   remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:212:17: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
           std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
           ~~~~~^~~~~~~~~~~
                enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:225:12: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
      std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
      ~~~~~^~~~~~~~~~~
           enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:234:12: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
      std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr) {
      ~~~~~^~~~~~~~~~~
           enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/run_program_wrapper.cpp:15:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/wrapper_function_utils.h:18:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:372:10: error: no template named 'aligned_union_t' in namespace 'std'
    std::aligned_union_t<1, storage_type> TStorage;
    ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:373:10: error: no template named 'aligned_union_t' in namespace 'std'
    std::aligned_union_t<1, error_type> ErrorStorage;
    ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:345:46: error: use of undeclared identifier 'TStorage'
    return reinterpret_cast<storage_type *>(&TStorage);
                                             ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:350:52: error: use of undeclared identifier 'TStorage'
    return reinterpret_cast<const storage_type *>(&TStorage);
                                                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[3/4] Building CXX object compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/macho_platform.cpp.o
FAILED: compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/macho_platform.cpp.o 
/repo/uabelho/master-github/llvm/build-all-bbigcc-builtins/./bin/clang++ --target=x86_64-unknown-linux-gnu  -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/repo/uabelho/master-github/compiler-rt/lib/orc/.. -I/repo/uabelho/master-github/compiler-rt/lib/orc/../../include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG    -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Werror=thread-safety -Werror=thread-safety-reference -Werror=thread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -I/repo/uabelho/master-github/llvm/build-all-bbigcc-builtins/include -I/repo/uabelho/master-github/llvm/include -UNDEBUG -MD -MT compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/macho_platform.cpp.o -MF compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/macho_platform.cpp.o.d -o compiler-rt/lib/orc/CMakeFiles/RTOrc.x86_64.dir/macho_platform.cpp.o -c /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:38:
/repo/uabelho/master-github/compiler-rt/lib/orc/endianness.h:132:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
       ~~~~~^~~~~~~~~~~
            enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:38:
/repo/uabelho/master-github/compiler-rt/lib/orc/endianness.h:134:40: error: no template named 'underlying_type_t' in namespace 'std'; did you mean 'underlying_type'?
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                  ~~~~~^~~~~~~~~~~~~~~~~
                                       underlying_type
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1855:12: note: 'underlying_type' declared here
    struct underlying_type
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/error.h:14:
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:24:56: error: no template named 'index_sequence' in namespace 'std'
decltype(auto) apply_tuple_impl(F &&f, Tuple &&t, std::index_sequence<I...>) {
                                                  ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:37:24: error: no template named 'make_index_sequence' in namespace 'std'
  using Indices = std::make_index_sequence<
                  ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/stl_extras.h:41:35: error: use of undeclared identifier 'Indices'
                                  Indices{});
                                  ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:21: error: no member named 'make_unique' in namespace 'std'
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
               ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:33: error: 'ErrT' does not refer to a value
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:133:20: note: declared here
template <typename ErrT, typename... ArgTs> Error make_error(ArgTs &&...Args) {
                   ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:64: error: expected ')'
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                                               ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:136:38: note: to match this '('
  return Error(std::make_unique<ErrT>(std::forward<ArgTs>(Args)...));
                                     ^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:192:44: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using wrap = std::reference_wrapper<std::remove_reference_t<T>>;
                                      ~~~~~^~~~~~~~~~~~~~~~~~
                                           remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:194:29: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'?
  using storage_type = std::conditional_t<IsRef, wrap, T>;
                       ~~~~~^~~~~~~~~~~~~
                            conditional
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1780:12: note: 'conditional' declared here
    struct conditional
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:197:26: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using reference = std::remove_reference_t<T> &;
                    ~~~~~^~~~~~~~~~~~~~~~~~
                         remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:198:38: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using const_reference = const std::remove_reference_t<T> &;
                                ~~~~~^~~~~~~~~~~~~~~~~~
                                     remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:199:24: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using pointer = std::remove_reference_t<T> *;
                  ~~~~~^~~~~~~~~~~~~~~~~~
                       remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:200:36: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using const_pointer = const std::remove_reference_t<T> *;
                              ~~~~~^~~~~~~~~~~~~~~~~~
                                   remove_reference
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1374:12: note: 'remove_reference' declared here
    struct remove_reference
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:212:17: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
           std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
           ~~~~~^~~~~~~~~~~
                enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:225:12: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
      std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
      ~~~~~^~~~~~~~~~~
           enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:234:12: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
      std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr) {
      ~~~~~^~~~~~~~~~~
           enable_if
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:1766:12: note: 'enable_if' declared here
    struct enable_if 
           ^
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.cpp:13:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/macho_platform.h:17:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/executor_address.h:20:
In file included from /repo/uabelho/master-github/compiler-rt/lib/orc/simple_packed_serialization.h:39:
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:372:10: error: no template named 'aligned_union_t' in namespace 'std'
    std::aligned_union_t<1, storage_type> TStorage;
    ~~~~~^
/repo/uabelho/master-github/compiler-rt/lib/orc/error.h:373:10: error: no template named 'aligned_union_t' in namespace 'std'
    std::aligned_union_t<1, error_type> ErrorStorage;
    ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

I'm compiling with gcc 9.3.0, glibc 2.17, linux 3.10.

lhames added a subscriber: kuhnel.Jul 20 2021, 4:38 PM

Hi Mikael,

A lot of those errors look like the -std=c++14 flag is not being honoured.
Could you let me know how your LLVM build is configured? I'll see if I can
reproduce them.

Regards,
Lang.

Hi Mikael,

A lot of those errors look like the -std=c++14 flag is not being honoured.
Could you let me know how your LLVM build is configured? I'll see if I can
reproduce them.

Regards,
Lang.

Ok, I think my cmake command looks like this:

CC='/proj/bbi_twh/wh_bbi/x86_64-Linux2/bbigcc/1.9.3.0/crosscompiler/bin/gcc' CXX='/proj/bbi_twh/wh_bbi/x86_64-Linux2/bbigcc/1.9.3.0/crosscompiler/bin/g++' LDFLAGS='-Wl,-R/proj/bbi_twh/wh_bbi/x86_64-Linux3/z3/4.8.8-1/lib64' PATH=/proj/flexasic/app/ninja/1.8.2/SLED11-64/bin:$PATH  /app/vbuild/RHEL7-x86_64/cmake/3.16.4/bin/cmake /repo/uabelho/master-github/llvm --debug-trycompile -G Ninja -DCMAKE_MAKE_PROGRAM=/proj/flexasic/app/ninja/1.8.2/SLED11-64/bin/ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/compiler-clang -DLLVM_APPEND_VC_REV=OFF -DLLVM_CCACHE_BUILD=OFF -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld' -DLLVM_BUILTIN_TARGETS='i386-unknown-linux-gnu;x86_64-unknown-linux-gnu' -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind;compiler-rt' -DRUNTIMES_x86_64-unknown-linux-gnu_SANITIZER_USE_STATIC_LLVM_UNWINDER=ON -DRUNTIMES_x86_64-unknown-linux-gnu_SANITIZER_USE_STATIC_CXX_ABI=ON -DRUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY=ON -DRUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_CAN_EXECUTE_TESTS=OFF -DRUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY=OFF -DLLVM_RUNTIME_TARGETS='x86_64-unknown-linux-gnu' -DLLVM_ENABLE_Z3_SOLVER=ON -DLLVM_Z3_INSTALL_DIR=/proj/bbi_twh/wh_bbi/x86_64-Linux3/z3/4.8.8-1 -DLLVM_ENABLE_LIBPFM=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_STATIC_LINK_CXX_STDLIB=ON -DCLANG_ENABLE_ARCMT=OFF -DCLANG_TOOLING_BUILD_AST_INTROSPECTION=OFF -DCLANG_ROUND_TRIP_CC1_ARGS=OFF

Hi Mikael,

Thanks for your patience, and sorry that it has taken me so long to reply!

It looks like you're disabling other runtimes that require C++14. I suspect
that you just need to disable the ORC runtime too. You can do this by
passing
"-DCOMPILER_RT_BUILD_ORC:BOOL=OFF"
to cmake when configuring LLVM.

Kind Regards,
Lang.

RKSimon added inline comments.
/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
405

@lhames - I'm seeing self-assignment warnings for this - is this correct?

lhames added inline comments.Sep 13 2021, 5:29 PM
/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
405

Thanks for catching this. Those warnings are correct. How on earth did this ever work!?

Fixed in 3ca6eee2a975edcfa49d8adff6b90df6f8e1ba85.