[llvm] [ORC] Represent ORC interface names as SymbolNameSpecs (PR #224188)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 02:11:55 PDT 2026
https://github.com/lhames updated https://github.com/llvm/llvm-project/pull/224188
>From 27fbbd2b811fd77566b46ae9f5aa8ab3049b0ba4 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Thu, 17 Sep 2026 11:42:25 +1000
Subject: [PATCH] [ORC] Represent ORC interface names as SymbolNameSpecs
Declare the bootstrap and controller-interface name constants (the
SPSCI descriptors, dispatch and alloc-action names, ProxySpec::Name)
as SymbolNameSpecs, pairing each name with its mangling kind at the
point of declaration. recordAddr and recordProxy now take a
SymbolNameSpec and mangle-and-intern it internally; executor-side
registrations and the remaining intern sites mangle the name too, so
both sides still agree on the symbol.
All names are Verbatim, so this is name-neutral (mangling is a no-op);
flipping any of them to a mangled kind (e.g. C) is a follow-up.
---
.../llvm/ExecutionEngine/Orc/LookupAndApply.h | 8 ++-
.../llvm/ExecutionEngine/Orc/RecordProxy.h | 12 ++--
.../llvm/ExecutionEngine/Orc/SPSProxySpec.h | 3 +-
.../ExecutionEngine/Orc/Shared/OrcRTBridge.h | 21 +++----
.../Orc/Shared/SPSCI/CallSPSCI.h | 13 ++--
.../Orc/Shared/SPSCI/MemoryAccessSPSCI.h | 40 +++++++++----
.../Shared/SPSCI/NativeDylibManagerSPSCI.h | 11 ++--
.../Shared/SPSCI/SharedMemoryMapperSPSCI.h | 22 +++----
.../Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h | 20 ++++---
llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp | 40 ++++++++-----
.../Orc/COFFVCRuntimeSupport.cpp | 12 ++--
.../Orc/Debugging/DebuggerSupportPlugin.cpp | 4 +-
.../Orc/Debugging/PerfSupportPlugin.cpp | 12 ++--
.../ExecutionEngine/Orc/ELFNixPlatform.cpp | 4 +-
.../lib/ExecutionEngine/Orc/MachOPlatform.cpp | 6 +-
.../Orc/SelfExecutorProcessControl.cpp | 7 ++-
.../Orc/Shared/OrcRTBridge.cpp | 36 ++++++-----
.../ExecutionEngine/Orc/SimpleRemoteEPC.cpp | 7 ++-
.../DefaultHostBootstrapValues.cpp | 13 +++-
.../ExecutorSharedMemoryMapperService.cpp | 15 +++--
.../Orc/TargetProcess/OrcRTBootstrap.cpp | 59 +++++++++++--------
.../SimpleExecutorDylibManager.cpp | 13 +++-
.../SimpleExecutorMemoryManager.cpp | 18 ++++--
.../Orc/TargetProcess/UnwindInfoManager.cpp | 12 ++--
.../Orc/EPCGenericDylibManagerTest.cpp | 12 +++-
.../EPCGenericJITLinkMemoryManagerTest.cpp | 41 ++++++++-----
.../Orc/EPCGenericMemoryAccessTest.cpp | 28 +++++----
.../Orc/LookupAndApplyTest.cpp | 32 ++++++----
.../ExecutionEngine/Orc/ProxyTest.cpp | 21 ++++---
.../Orc/SharedMemoryMapperTest.cpp | 19 ++++--
30 files changed, 352 insertions(+), 209 deletions(-)
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LookupAndApply.h b/llvm/include/llvm/ExecutionEngine/Orc/LookupAndApply.h
index 991cfbd30ab77..c3e83168d1cd2 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LookupAndApply.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LookupAndApply.h
@@ -26,6 +26,8 @@
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
@@ -99,11 +101,13 @@ LLVM_ABI Error lookupAndApply(JITDylib &JD,
/// collected its symbols: it is interned up front, and only the interned name
/// is retained.
inline LookupPrepareFn
-recordAddr(StringRef Name, ExecutorAddr *A,
+recordAddr(SymbolNameSpec Name, ExecutorAddr *A,
SymbolLookupFlags LF = SymbolLookupFlags::RequiredSymbol) {
return [Name, A, LF](SymbolLookupSet &LS,
ExecutionSession &ES) -> LookupApplyFn {
- auto N = ES.intern(Name);
+ auto N =
+ Mangler(ES.getTargetTriple())
+ .withMangledNameDo([&](StringRef M) { return ES.intern(M); }, Name);
LS.add(N, LF);
return [A, N = std::move(N)](const SymbolMap &M) {
*A = M.lookup(N).getAddress();
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RecordProxy.h b/llvm/include/llvm/ExecutionEngine/Orc/RecordProxy.h
index 62a6ff8f1c88a..5b8a0f0faef63 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RecordProxy.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RecordProxy.h
@@ -19,6 +19,8 @@
#include "llvm/ExecutionEngine/Orc/LookupAndApply.h"
#include "llvm/ExecutionEngine/Orc/Proxy.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
namespace llvm::orc {
@@ -28,11 +30,13 @@ namespace llvm::orc {
template <typename FnT>
LookupPrepareFn
recordProxy(Proxy<FnT> *P, typename Proxy<FnT>::DispatchFn Dispatch,
- StringRef Name,
+ SymbolNameSpec Name,
SymbolLookupFlags LF = SymbolLookupFlags::RequiredSymbol) {
return [P, Dispatch, Name, LF](SymbolLookupSet &LS,
ExecutionSession &ES) -> LookupApplyFn {
- auto N = ES.intern(Name);
+ auto N =
+ Mangler(ES.getTargetTriple())
+ .withMangledNameDo([&](StringRef M) { return ES.intern(M); }, Name);
LS.add(N, LF);
return [P, Dispatch, N = std::move(N)](const SymbolMap &M) {
auto Sym = M.lookup(N);
@@ -75,9 +79,9 @@ recordProxy(Proxy<FnT> *P,
/// spec's default controller-interface name.
template <typename ProxySpecT, typename FnT>
LookupPrepareFn
-recordProxy(Proxy<FnT> *P, StringRef Name,
+recordProxy(Proxy<FnT> *P, SymbolNameSpec Name,
SymbolLookupFlags LF = SymbolLookupFlags::RequiredSymbol) {
- return recordProxy(P, ProxySpecT::dispatch, Name, LF);
+ return recordProxy(P, ProxySpecT::dispatch, std::move(Name), LF);
}
/// Builds P from the given spec, but resolves it under the given,
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SPSProxySpec.h b/llvm/include/llvm/ExecutionEngine/Orc/SPSProxySpec.h
index f5cdeeb5ca224..898b5a857ca13 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/SPSProxySpec.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/SPSProxySpec.h
@@ -22,6 +22,7 @@
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/Proxy.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
namespace llvm::orc::sps {
@@ -45,7 +46,7 @@ class ProxySpec<ProxyT, CI, RetT(ArgTs...)> {
}
public:
- static constexpr const char *Name = CI::Name;
+ static constexpr SymbolNameSpec Name = CI::Name;
static void dispatch(unique_function<void(ErrorRetT)> OnComplete,
ExecutionSession &ES, ExecutorAddr CalleeAddr,
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
index 8937ec266c6ed..5f867edf07869 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
@@ -15,6 +15,7 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
#include "llvm/Support/Compiler.h"
@@ -22,20 +23,20 @@ namespace llvm {
namespace orc {
namespace rt {
-LLVM_ABI extern const char *RegisterEHFrameSectionAllocActionName;
-LLVM_ABI extern const char *DeregisterEHFrameSectionAllocActionName;
+LLVM_ABI extern const SymbolNameSpec RegisterEHFrameSectionAllocActionName;
+LLVM_ABI extern const SymbolNameSpec DeregisterEHFrameSectionAllocActionName;
-LLVM_ABI extern const char *RegisterJITLoaderGDBAllocActionName;
-LLVM_ABI extern const char *DeregisterJITLoaderGDBAllocActionName;
+LLVM_ABI extern const SymbolNameSpec RegisterJITLoaderGDBAllocActionName;
+LLVM_ABI extern const SymbolNameSpec DeregisterJITLoaderGDBAllocActionName;
-LLVM_ABI extern const char *const DispatchName;
-LLVM_ABI extern const char *const DispatchCtxName;
+LLVM_ABI extern const SymbolNameSpec DispatchName;
+LLVM_ABI extern const SymbolNameSpec DispatchCtxName;
/// Symbol names for the ORC runtime's StandaloneMachOUnwindInfoRegistrar
/// SPS interface.
struct MachOUnwindInfoRegistrarSymbolNames {
- StringRef RegisterSectionsName;
- StringRef DeregisterSectionsName;
+ SymbolNameSpec RegisterSectionsName;
+ SymbolNameSpec DeregisterSectionsName;
};
/// Default symbol names for the ORC runtime's
@@ -46,8 +47,8 @@ extern const LLVM_ABI MachOUnwindInfoRegistrarSymbolNames
} // end namespace rt
namespace rt_alt {
-LLVM_ABI extern const char *UnwindInfoManagerRegisterActionName;
-LLVM_ABI extern const char *UnwindInfoManagerDeregisterActionName;
+LLVM_ABI extern const SymbolNameSpec UnwindInfoManagerRegisterActionName;
+LLVM_ABI extern const SymbolNameSpec UnwindInfoManagerDeregisterActionName;
} // end namespace rt_alt
} // end namespace orc
} // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/CallSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/CallSPSCI.h
index 24bc79fa9493f..aace4bf1fcef7 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/CallSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/CallSPSCI.h
@@ -21,6 +21,7 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include <cstdint>
@@ -29,7 +30,8 @@ namespace llvm::orc::rt::sps_ci {
/// Runs a main-like function (int(int argc, char *argv[])) in the executor.
/// Takes the function's address and an argument vector.
struct CallMain {
- static constexpr char Name[] = "orc_rt_ci_sps_call_main";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_call_main");
using SPSSig = int64_t(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSString>);
};
@@ -37,21 +39,24 @@ struct CallMain {
/// Runs a void() function in the executor, given its address.
/// WARNING: This operation is experimental and may be removed.
struct CallVoidVoid {
- static constexpr char Name[] = "orc_rt_ci_sps_call_void_void";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_call_void_void");
using SPSSig = void(shared::SPSExecutorAddr);
};
/// Runs an int32_t() function in the executor, given its address.
/// WARNING: This operation is experimental and may be removed.
struct CallInt32Void {
- static constexpr char Name[] = "orc_rt_ci_sps_call_int32_void";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_call_int32_void");
using SPSSig = int32_t(shared::SPSExecutorAddr);
};
/// Runs an int32_t(int32_t) function in the executor, given its address.
/// WARNING: This operation is experimental and may be removed.
struct CallInt32Int32 {
- static constexpr char Name[] = "orc_rt_ci_sps_call_int32_int32";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_call_int32_int32");
using SPSSig = int32_t(shared::SPSExecutorAddr, int32_t);
};
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h
index 48d7833fbcebc..52f8c7911df26 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h
@@ -19,6 +19,7 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
#include <cstdint>
@@ -26,73 +27,86 @@
namespace llvm::orc::rt::sps_ci {
struct MemWriteUInt8s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_uint8s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_uint8s");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessUInt8Write>);
};
struct MemWriteUInt16s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_uint16s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_uint16s");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessUInt16Write>);
};
struct MemWriteUInt32s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_uint32s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_uint32s");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessUInt32Write>);
};
struct MemWriteUInt64s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_uint64s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_uint64s");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessUInt64Write>);
};
struct MemWritePointers {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_pointers";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_pointers");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessPointerWrite>);
};
struct MemWriteBuffers {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_write_buffers";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_write_buffers");
using SPSSig = void(shared::SPSSequence<shared::SPSMemoryAccessBufferWrite>);
};
struct MemReadUInt8s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_uint8s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_uint8s");
using SPSSig = shared::SPSSequence<uint8_t>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct MemReadUInt16s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_uint16s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_uint16s");
using SPSSig = shared::SPSSequence<uint16_t>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct MemReadUInt32s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_uint32s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_uint32s");
using SPSSig = shared::SPSSequence<uint32_t>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct MemReadUInt64s {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_uint64s";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_uint64s");
using SPSSig = shared::SPSSequence<uint64_t>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct MemReadPointers {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_pointers";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_pointers");
using SPSSig = shared::SPSSequence<shared::SPSExecutorAddr>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct MemReadBuffers {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_buffers";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_buffers");
using SPSSig = shared::SPSSequence<shared::SPSSequence<uint8_t>>(
shared::SPSSequence<shared::SPSExecutorAddrRange>);
};
struct MemReadStrings {
- static constexpr char Name[] = "orc_rt_ci_sps_mem_read_strings";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_mem_read_strings");
using SPSSig = shared::SPSSequence<shared::SPSString>(
shared::SPSSequence<shared::SPSExecutorAddr>);
};
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/NativeDylibManagerSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/NativeDylibManagerSPSCI.h
index e0b101b383419..2db0959d840e7 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/NativeDylibManagerSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/NativeDylibManagerSPSCI.h
@@ -20,6 +20,7 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include <cstdint>
@@ -27,20 +28,22 @@ namespace llvm::orc::rt::sps_ci {
/// The executor-side dylib-manager instance. This is a data symbol -- passed
/// as the first argument to each call below -- not a wrapper to call.
-inline constexpr char NativeDylibManagerInstanceName[] =
- "orc_rt_ci_NativeDylibManager_Instance";
+inline constexpr SymbolNameSpec NativeDylibManagerInstanceName =
+ SymbolNameSpec::verbatim("orc_rt_ci_NativeDylibManager_Instance");
/// Open the dylib at the given path with the given mode flags; returns a
/// handle to it.
struct DylibMgrOpen {
- static constexpr char Name[] = "orc_rt_ci_sps_NativeDylibManager_load";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_NativeDylibManager_load");
using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>(
shared::SPSExecutorAddr, shared::SPSString, uint64_t);
};
/// Resolve the given lookup set within the given dylib.
struct DylibMgrResolve {
- static constexpr char Name[] = "orc_rt_ci_sps_NativeDylibManager_lookup";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_NativeDylibManager_lookup");
using SPSSig = shared::SPSExpected<
shared::SPSSequence<shared::SPSOptional<shared::SPSExecutorAddr>>>(
shared::SPSExecutorAddr, shared::SPSExecutorAddr,
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h
index 9e7e30dc18390..6cd5598786a4e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h
@@ -16,41 +16,43 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
#include <cstdint>
namespace llvm::orc::rt::sps_ci {
-inline constexpr char SharedMemoryMapperInstanceName[] =
- "__llvm_orc_ExecutorSharedMemoryMapperService_Instance";
+inline constexpr SymbolNameSpec SharedMemoryMapperInstanceName =
+ SymbolNameSpec::verbatim(
+ "__llvm_orc_ExecutorSharedMemoryMapperService_Instance");
struct SharedMemoryMapperReserve {
- static constexpr char Name[] =
- "__llvm_orc_ExecutorSharedMemoryMapperService_Reserve";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "__llvm_orc_ExecutorSharedMemoryMapperService_Reserve");
using SPSSig = shared::SPSExpected<
shared::SPSTuple<shared::SPSExecutorAddr, shared::SPSString>>(
shared::SPSExecutorAddr, uint64_t);
};
struct SharedMemoryMapperInitialize {
- static constexpr char Name[] =
- "__llvm_orc_ExecutorSharedMemoryMapperService_Initialize";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "__llvm_orc_ExecutorSharedMemoryMapperService_Initialize");
using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>(
shared::SPSExecutorAddr, shared::SPSExecutorAddr,
shared::SPSSharedMemoryFinalizeRequest);
};
struct SharedMemoryMapperDeinitialize {
- static constexpr char Name[] =
- "__llvm_orc_ExecutorSharedMemoryMapperService_Deinitialize";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "__llvm_orc_ExecutorSharedMemoryMapperService_Deinitialize");
using SPSSig = shared::SPSError(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSExecutorAddr>);
};
struct SharedMemoryMapperRelease {
- static constexpr char Name[] =
- "__llvm_orc_ExecutorSharedMemoryMapperService_Release";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "__llvm_orc_ExecutorSharedMemoryMapperService_Release");
using SPSSig = shared::SPSError(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSExecutorAddr>);
};
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h
index cb4d85f4071f9..6b1abd8fede94 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h
@@ -23,6 +23,7 @@
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
+#include "llvm/ExecutionEngine/Orc/Shared/SymbolNameSpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
#include <cstdint>
@@ -32,20 +33,21 @@ namespace llvm::orc::rt::sps_ci {
/// The executor-side memory-manager instance. This is a data symbol (the
/// allocator object) -- passed as the first argument to each call below -- not
/// a wrapper to call.
-inline constexpr char SimpleNativeMemoryMapInstanceName[] =
- "orc_rt_ci_SimpleNativeMemoryMap_Instance";
+inline constexpr SymbolNameSpec SimpleNativeMemoryMapInstanceName =
+ SymbolNameSpec::verbatim("orc_rt_ci_SimpleNativeMemoryMap_Instance");
/// Reserve an address range of the given size; returns its base.
struct MemMgrReserve {
- static constexpr char Name[] = "orc_rt_ci_sps_SimpleNativeMemoryMap_reserve";
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::verbatim("orc_rt_ci_sps_SimpleNativeMemoryMap_reserve");
using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>(
shared::SPSExecutorAddr, uint64_t);
};
/// Apply a finalize request; returns a key for the initialized allocation.
struct MemMgrInitialize {
- static constexpr char Name[] =
- "orc_rt_ci_sps_SimpleNativeMemoryMap_initialize";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "orc_rt_ci_sps_SimpleNativeMemoryMap_initialize");
using SPSSig = shared::SPSExpected<shared::SPSExecutorAddr>(
shared::SPSExecutorAddr, shared::SPSFinalizeRequest);
};
@@ -53,16 +55,16 @@ struct MemMgrInitialize {
/// Deinitialize the allocations with the given base addresses (running their
/// deallocation actions) without releasing their memory.
struct MemMgrDeinitialize {
- static constexpr char Name[] =
- "orc_rt_ci_sps_SimpleNativeMemoryMap_deinitializeMultiple";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "orc_rt_ci_sps_SimpleNativeMemoryMap_deinitializeMultiple");
using SPSSig = shared::SPSError(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSExecutorAddr>);
};
/// Release the allocations with the given base addresses.
struct MemMgrRelease {
- static constexpr char Name[] =
- "orc_rt_ci_sps_SimpleNativeMemoryMap_releaseMultiple";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim(
+ "orc_rt_ci_sps_SimpleNativeMemoryMap_releaseMultiple");
using SPSSig = shared::SPSError(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSExecutorAddr>);
};
diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
index fc9c5f952bf42..a183e2570c4a8 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/COFFPlatform.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/ExecutionEngine/Orc/COFF.h"
#include "llvm/ExecutionEngine/Orc/CallProxiesSPS.h"
@@ -192,9 +193,10 @@ COFFPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
{
// Add JIT dispatch reexports from bootstrap JITDylib.
+ MangleAndInterner Mangle(ES);
auto Exports = buildSimpleReexportsAliasMap(
ES.getBootstrapJITDylib(),
- {{ES.intern(rt::DispatchName), ES.intern(rt::DispatchCtxName)}});
+ {{Mangle(rt::DispatchName), Mangle(rt::DispatchCtxName)}});
if (!Exports)
return Exports.takeError();
if (auto Err =
@@ -680,18 +682,25 @@ Error COFFPlatform::bootstrapCOFFRuntime(JITDylib &PlatformJD) {
// Lookup of runtime symbols causes the collection of initializers if
// it's static linking setting.
if (auto Err = lookupAndApply(
- PlatformJD, {recordAddr("__orc_rt_coff_platform_bootstrap",
- &orc_rt_coff_platform_bootstrap),
- recordAddr("__orc_rt_coff_platform_shutdown",
- &orc_rt_coff_platform_shutdown),
- recordAddr("__orc_rt_coff_register_jitdylib",
- &orc_rt_coff_register_jitdylib),
- recordAddr("__orc_rt_coff_deregister_jitdylib",
- &orc_rt_coff_deregister_jitdylib),
- recordAddr("__orc_rt_coff_register_object_sections",
- &orc_rt_coff_register_object_sections),
- recordAddr("__orc_rt_coff_deregister_object_sections",
- &orc_rt_coff_deregister_object_sections)}))
+ PlatformJD,
+ {recordAddr(
+ SymbolNameSpec::verbatim("__orc_rt_coff_platform_bootstrap"),
+ &orc_rt_coff_platform_bootstrap),
+ recordAddr(
+ SymbolNameSpec::verbatim("__orc_rt_coff_platform_shutdown"),
+ &orc_rt_coff_platform_shutdown),
+ recordAddr(
+ SymbolNameSpec::verbatim("__orc_rt_coff_register_jitdylib"),
+ &orc_rt_coff_register_jitdylib),
+ recordAddr(
+ SymbolNameSpec::verbatim("__orc_rt_coff_deregister_jitdylib"),
+ &orc_rt_coff_deregister_jitdylib),
+ recordAddr(SymbolNameSpec::verbatim(
+ "__orc_rt_coff_register_object_sections"),
+ &orc_rt_coff_register_object_sections),
+ recordAddr(SymbolNameSpec::verbatim(
+ "__orc_rt_coff_deregister_object_sections"),
+ &orc_rt_coff_deregister_object_sections)}))
return Err;
// Call bootstrap functions
@@ -729,8 +738,9 @@ Error COFFPlatform::runSymbolIfExists(JITDylib &PlatformJD,
StringRef SymbolName) {
ExecutorAddr TargetFn;
if (auto Err = lookupAndApply(
- PlatformJD, {recordAddr(SymbolName, &TargetFn,
- SymbolLookupFlags::WeaklyReferencedSymbol)}))
+ PlatformJD,
+ {recordAddr(SymbolNameSpec::verbatim(SymbolName), &TargetFn,
+ SymbolLookupFlags::WeaklyReferencedSymbol)}))
return Err;
if (!TargetFn)
return Error::success(); // No target function.
diff --git a/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp b/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
index 1293004747b59..7dff95643ca9b 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
@@ -115,12 +115,16 @@ Error COFFVCRuntimeBootstrapper::initializeStaticVCRuntime(JITDylib &JD) {
jit_scrt_initialize_type_info,
jit_scrt_initialize_default_local_stdio_options;
if (auto Err = lookupAndApply(
- JD, {recordAddr("__scrt_initialize_crt", &jit_scrt_initialize),
- recordAddr("__scrt_dllmain_before_initialize_c",
+ JD, {recordAddr(SymbolNameSpec::verbatim("__scrt_initialize_crt"),
+ &jit_scrt_initialize),
+ recordAddr(SymbolNameSpec::verbatim(
+ "__scrt_dllmain_before_initialize_c"),
&jit_scrt_dllmain_before_initialize_c),
- recordAddr("?__scrt_initialize_type_info@@YAXXZ",
+ recordAddr(SymbolNameSpec::verbatim(
+ "?__scrt_initialize_type_info@@YAXXZ"),
&jit_scrt_initialize_type_info),
- recordAddr("__scrt_initialize_default_local_stdio_options",
+ recordAddr(SymbolNameSpec::verbatim(
+ "__scrt_initialize_default_local_stdio_options"),
&jit_scrt_initialize_default_local_stdio_options)}))
return Err;
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
index 93570625db0c3..b6777e4e18ec4 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
@@ -11,6 +11,7 @@
#include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h"
#include "llvm/ExecutionEngine/Orc/MachOBuilder.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/ADT/SmallVector.h"
@@ -328,7 +329,8 @@ namespace orc {
Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>>
GDBJITDebugInfoRegistrationPlugin::Create(ExecutionSession &ES,
JITDylib &BootstrapJD) {
- auto RegisterActionName = ES.intern(rt::RegisterJITLoaderGDBAllocActionName);
+ auto RegisterActionName =
+ MangleAndInterner(ES)(rt::RegisterJITLoaderGDBAllocActionName);
if (auto RegisterSym = ES.lookup({&BootstrapJD}, RegisterActionName))
return std::make_unique<GDBJITDebugInfoRegistrationPlugin>(
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp
index e52c5dabbcf7e..7eca2df473d57 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp
@@ -76,12 +76,12 @@ Expected<std::string> createX64EHFrameHeader(Section &EHFrame,
return HeaderContent;
}
-constexpr StringRef RegisterPerfStartSymbolName =
- "llvm_orc_registerJITLoaderPerfStart";
-constexpr StringRef RegisterPerfEndSymbolName =
- "llvm_orc_registerJITLoaderPerfEnd";
-constexpr StringRef RegisterPerfImplSymbolName =
- "llvm_orc_registerJITLoaderPerfImpl";
+constexpr SymbolNameSpec RegisterPerfStartSymbolName =
+ SymbolNameSpec::verbatim("llvm_orc_registerJITLoaderPerfStart");
+constexpr SymbolNameSpec RegisterPerfEndSymbolName =
+ SymbolNameSpec::verbatim("llvm_orc_registerJITLoaderPerfEnd");
+constexpr SymbolNameSpec RegisterPerfImplSymbolName =
+ SymbolNameSpec::verbatim("llvm_orc_registerJITLoaderPerfImpl");
static PerfJITCodeLoadRecord
getCodeLoadRecord(const Symbol &Sym, std::atomic<uint64_t> &CodeIndex) {
diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
index 4a01a3865682b..dc03d2047e943 100644
--- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/ELFNixPlatform.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/ExecutionEngine/JITLink/aarch64.h"
#include "llvm/ExecutionEngine/JITLink/loongarch.h"
@@ -232,9 +233,10 @@ ELFNixPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer,
{
// Add JIT dispatch reexports from bootstrap JITDylib.
+ MangleAndInterner Mangle(ES);
auto Exports = buildSimpleReexportsAliasMap(
ES.getBootstrapJITDylib(),
- {{ES.intern(rt::DispatchName), ES.intern(rt::DispatchCtxName)}});
+ {{Mangle(rt::DispatchName), Mangle(rt::DispatchCtxName)}});
if (!Exports)
return Exports.takeError();
if (auto Err =
diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 31ec677a778fb..2e9fa50d7cff7 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/MachOPlatform.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
@@ -302,13 +303,14 @@ MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
{
// Add JIT dispatch reexports from bootstrap JITDylib.
+ MangleAndInterner Mangle(ES);
if (auto Err = PlatformJD.define(reexports(
ES.getBootstrapJITDylib(),
{{ES.intern("___orc_rt_jit_dispatch"),
- {ES.intern(rt::DispatchName),
+ {Mangle(rt::DispatchName),
JITSymbolFlags::Exported | JITSymbolFlags::Callable}},
{ES.intern("___orc_rt_jit_dispatch_ctx"),
- {ES.intern(rt::DispatchCtxName), JITSymbolFlags::Exported}}})))
+ {Mangle(rt::DispatchCtxName), JITSymbolFlags::Exported}}})))
return Err;
}
diff --git a/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
index c84b7b72275ce..1e5edc325dd67 100644
--- a/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
@@ -47,9 +48,11 @@ SelfExecutorProcessControl::SelfExecutorProcessControl(
addDefaultBootstrapValuesForHostProcess(BootstrapMap, BootstrapSymbols);
rt_bootstrap::addRunAsFunctionWrappersTo(BootstrapSymbols);
- BootstrapSymbols[rt::DispatchName] =
+ Mangler Mangle(getTargetTriple());
+ BootstrapSymbols[Mangle.mangledCopy(rt::DispatchName)] =
ExecutorAddr::fromPtr(jitDispatchViaWrapperFunctionManager);
- BootstrapSymbols[rt::DispatchCtxName] = ExecutorAddr::fromPtr(this);
+ BootstrapSymbols[Mangle.mangledCopy(rt::DispatchCtxName)] =
+ ExecutorAddr::fromPtr(this);
#ifdef __APPLE__
// FIXME: Don't add an UnwindInfoManager by default -- it's redundant when
diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
index 5f5cdda1500fd..5afebdc924b44 100644
--- a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
@@ -12,30 +12,34 @@ namespace llvm {
namespace orc {
namespace rt {
-const char *RegisterEHFrameSectionAllocActionName =
- "llvm_orc_registerEHFrameAllocAction";
-const char *DeregisterEHFrameSectionAllocActionName =
- "llvm_orc_deregisterEHFrameAllocAction";
+const SymbolNameSpec RegisterEHFrameSectionAllocActionName =
+ SymbolNameSpec::verbatim("llvm_orc_registerEHFrameAllocAction");
+const SymbolNameSpec DeregisterEHFrameSectionAllocActionName =
+ SymbolNameSpec::verbatim("llvm_orc_deregisterEHFrameAllocAction");
-const char *RegisterJITLoaderGDBAllocActionName =
- "orc_rt_ci_aa_sps_GDBJITRegistrar_register";
-const char *DeregisterJITLoaderGDBAllocActionName =
- "orc_rt_ci_aa_sps_GDBJITRegistrar_deregister";
+const SymbolNameSpec RegisterJITLoaderGDBAllocActionName =
+ SymbolNameSpec::verbatim("orc_rt_ci_aa_sps_GDBJITRegistrar_register");
+const SymbolNameSpec DeregisterJITLoaderGDBAllocActionName =
+ SymbolNameSpec::verbatim("orc_rt_ci_aa_sps_GDBJITRegistrar_deregister");
-const char *const DispatchName = "__orc_rt_jit_dispatch";
-const char *const DispatchCtxName = "__orc_rt_jit_dispatch_ctx";
+const SymbolNameSpec DispatchName =
+ SymbolNameSpec::verbatim("__orc_rt_jit_dispatch");
+const SymbolNameSpec DispatchCtxName =
+ SymbolNameSpec::verbatim("__orc_rt_jit_dispatch_ctx");
const MachOUnwindInfoRegistrarSymbolNames
orc_rt_MachOUnwindInfoRegistrarSPSSymbols = {
- "orc_rt_ci_aa_sps_MachOUnwindInfoRegistrar_registerSections",
- "orc_rt_ci_aa_sps_MachOUnwindInfoRegistrar_deregisterSections"};
+ SymbolNameSpec::verbatim(
+ "orc_rt_ci_aa_sps_MachOUnwindInfoRegistrar_registerSections"),
+ SymbolNameSpec::verbatim(
+ "orc_rt_ci_aa_sps_MachOUnwindInfoRegistrar_deregisterSections")};
} // end namespace rt
namespace rt_alt {
-const char *UnwindInfoManagerRegisterActionName =
- "orc_rt_alt_UnwindInfoManager_register";
-const char *UnwindInfoManagerDeregisterActionName =
- "orc_rt_alt_UnwindInfoManager_deregister";
+const SymbolNameSpec UnwindInfoManagerRegisterActionName =
+ SymbolNameSpec::verbatim("orc_rt_alt_UnwindInfoManager_register");
+const SymbolNameSpec UnwindInfoManagerDeregisterActionName =
+ SymbolNameSpec::verbatim("orc_rt_alt_UnwindInfoManager_deregister");
} // end namespace rt_alt
} // end namespace orc
diff --git a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
index c47fef1b9cd40..ce3cb371ef8d7 100644
--- a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
@@ -13,6 +13,7 @@
#include "llvm/ExecutionEngine/Orc/EPCGenericMemoryAccessSPS.h"
#include "llvm/ExecutionEngine/Orc/LookupAndApply.h"
#include "llvm/ExecutionEngine/Orc/RecordProxy.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/Support/FormatVariadic.h"
@@ -340,8 +341,10 @@ Error SimpleRemoteEPC::setup() {
BootstrapMap = std::move(EI->BootstrapMap);
BootstrapSymbols = std::move(EI->BootstrapSymbols);
- BootstrapSymbols[rt::DispatchName] = BootstrapSymbols[DispatchFnName];
- BootstrapSymbols[rt::DispatchCtxName] =
+ Mangler Mangle(getTargetTriple());
+ BootstrapSymbols[Mangle.mangledCopy(rt::DispatchName)] =
+ BootstrapSymbols[DispatchFnName];
+ BootstrapSymbols[Mangle.mangledCopy(rt::DispatchCtxName)] =
BootstrapSymbols[ExecutorSessionObjectName];
return Error::success();
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.cpp
index 81d95c6732be5..2ea1eeb3beb9c 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.cpp
@@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
@@ -21,14 +24,18 @@ namespace llvm::orc {
void addDefaultBootstrapValuesForHostProcess(
StringMap<std::vector<char>> &BootstrapMap,
StringMap<ExecutorAddr> &BootstrapSymbols) {
+ Mangler Mangle{Triple(sys::getProcessTriple())};
// FIXME: We probably shouldn't set these on Windows?
- BootstrapSymbols[rt::RegisterEHFrameSectionAllocActionName] =
+ BootstrapSymbols[Mangle.mangledCopy(
+ rt::RegisterEHFrameSectionAllocActionName)] =
ExecutorAddr::fromPtr(&llvm_orc_registerEHFrameSectionAllocAction);
- BootstrapSymbols[rt::DeregisterEHFrameSectionAllocActionName] =
+ BootstrapSymbols[Mangle.mangledCopy(
+ rt::DeregisterEHFrameSectionAllocActionName)] =
ExecutorAddr::fromPtr(&llvm_orc_deregisterEHFrameSectionAllocAction);
- BootstrapSymbols[rt::RegisterJITLoaderGDBAllocActionName] =
+ BootstrapSymbols[Mangle.mangledCopy(
+ rt::RegisterJITLoaderGDBAllocActionName)] =
ExecutorAddr::fromPtr(&llvm_orc_registerJITLoaderGDBAllocAction);
#ifdef __APPLE__
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
index bc09eb84868ef..4aff84d23cc97 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
@@ -8,10 +8,13 @@
#include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h"
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/WindowsError.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include <sstream>
#if defined(LLVM_ON_UNIX)
@@ -310,14 +313,16 @@ Error ExecutorSharedMemoryMapperService::shutdown() {
void ExecutorSharedMemoryMapperService::addBootstrapSymbols(
StringMap<ExecutorAddr> &M) {
- M[rt::sps_ci::SharedMemoryMapperInstanceName] = ExecutorAddr::fromPtr(this);
- M[rt::sps_ci::SharedMemoryMapperReserve::Name] =
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ M[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperInstanceName)] =
+ ExecutorAddr::fromPtr(this);
+ M[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperReserve::Name)] =
ExecutorAddr::fromPtr(&reserveWrapper);
- M[rt::sps_ci::SharedMemoryMapperInitialize::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperInitialize::Name)] =
ExecutorAddr::fromPtr(&initializeWrapper);
- M[rt::sps_ci::SharedMemoryMapperDeinitialize::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperDeinitialize::Name)] =
ExecutorAddr::fromPtr(&deinitializeWrapper);
- M[rt::sps_ci::SharedMemoryMapperRelease::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperRelease::Name)] =
ExecutorAddr::fromPtr(&releaseWrapper);
}
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
index c1b91ebde8bc1..ba98909654ee2 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
@@ -8,6 +8,10 @@
#include "llvm/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
+
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/CallSPSCI.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h"
#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
@@ -156,44 +160,51 @@ runAsInt32Int32FunctionWrapper(const char *ArgData, size_t ArgSize) {
}
void addRunAsFunctionWrappersTo(StringMap<ExecutorAddr> &M) {
- M[rt::sps_ci::CallInt32Void::Name] =
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ M[Mangle.mangledCopy(rt::sps_ci::CallInt32Void::Name)] =
ExecutorAddr::fromPtr(&runAsInt32VoidFunctionWrapper);
- M[rt::sps_ci::CallInt32Int32::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::CallInt32Int32::Name)] =
ExecutorAddr::fromPtr(&runAsInt32Int32FunctionWrapper);
}
void addTo(StringMap<ExecutorAddr> &M) {
- M[rt::sps_ci::MemWriteUInt8s::Name] = ExecutorAddr::fromPtr(
- &writeUIntsWrapper<tpctypes::UInt8Write,
- shared::SPSMemoryAccessUInt8Write>);
- M[rt::sps_ci::MemWriteUInt16s::Name] = ExecutorAddr::fromPtr(
- &writeUIntsWrapper<tpctypes::UInt16Write,
- shared::SPSMemoryAccessUInt16Write>);
- M[rt::sps_ci::MemWriteUInt32s::Name] = ExecutorAddr::fromPtr(
- &writeUIntsWrapper<tpctypes::UInt32Write,
- shared::SPSMemoryAccessUInt32Write>);
- M[rt::sps_ci::MemWriteUInt64s::Name] = ExecutorAddr::fromPtr(
- &writeUIntsWrapper<tpctypes::UInt64Write,
- shared::SPSMemoryAccessUInt64Write>);
- M[rt::sps_ci::MemWritePointers::Name] =
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ M[Mangle.mangledCopy(rt::sps_ci::MemWriteUInt8s::Name)] =
+ ExecutorAddr::fromPtr(
+ &writeUIntsWrapper<tpctypes::UInt8Write,
+ shared::SPSMemoryAccessUInt8Write>);
+ M[Mangle.mangledCopy(rt::sps_ci::MemWriteUInt16s::Name)] =
+ ExecutorAddr::fromPtr(
+ &writeUIntsWrapper<tpctypes::UInt16Write,
+ shared::SPSMemoryAccessUInt16Write>);
+ M[Mangle.mangledCopy(rt::sps_ci::MemWriteUInt32s::Name)] =
+ ExecutorAddr::fromPtr(
+ &writeUIntsWrapper<tpctypes::UInt32Write,
+ shared::SPSMemoryAccessUInt32Write>);
+ M[Mangle.mangledCopy(rt::sps_ci::MemWriteUInt64s::Name)] =
+ ExecutorAddr::fromPtr(
+ &writeUIntsWrapper<tpctypes::UInt64Write,
+ shared::SPSMemoryAccessUInt64Write>);
+ M[Mangle.mangledCopy(rt::sps_ci::MemWritePointers::Name)] =
ExecutorAddr::fromPtr(&writePointersWrapper);
- M[rt::sps_ci::MemWriteBuffers::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemWriteBuffers::Name)] =
ExecutorAddr::fromPtr(&writeBuffersWrapper);
- M[rt::sps_ci::MemReadUInt8s::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadUInt8s::Name)] =
ExecutorAddr::fromPtr(&readUIntsWrapper<uint8_t>);
- M[rt::sps_ci::MemReadUInt16s::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadUInt16s::Name)] =
ExecutorAddr::fromPtr(&readUIntsWrapper<uint16_t>);
- M[rt::sps_ci::MemReadUInt32s::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadUInt32s::Name)] =
ExecutorAddr::fromPtr(&readUIntsWrapper<uint32_t>);
- M[rt::sps_ci::MemReadUInt64s::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadUInt64s::Name)] =
ExecutorAddr::fromPtr(&readUIntsWrapper<uint64_t>);
- M[rt::sps_ci::MemReadPointers::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadPointers::Name)] =
ExecutorAddr::fromPtr(&readPointersWrapper);
- M[rt::sps_ci::MemReadBuffers::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadBuffers::Name)] =
ExecutorAddr::fromPtr(&readBuffersWrapper);
- M[rt::sps_ci::MemReadStrings::Name] =
+ M[Mangle.mangledCopy(rt::sps_ci::MemReadStrings::Name)] =
ExecutorAddr::fromPtr(&readStringsWrapper);
- M[rt::sps_ci::CallMain::Name] = ExecutorAddr::fromPtr(&runAsMainWrapper);
+ M[Mangle.mangledCopy(rt::sps_ci::CallMain::Name)] =
+ ExecutorAddr::fromPtr(&runAsMainWrapper);
addRunAsFunctionWrappersTo(M);
}
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
index f76b84b609ffe..71f4f9eb0e8a7 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
@@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/NativeDylibManagerSPSCI.h"
@@ -69,13 +72,17 @@ Error SimpleExecutorDylibManager::shutdown() {
void SimpleExecutorDylibManager::addBootstrapSymbols(
StringMap<ExecutorAddr> &M) {
+ Mangler Mangle{Triple(sys::getProcessTriple())};
// SimpleExecutorDylibManager is the LLVM-side implementation of the runtime's
// NativeDylibManager controller interface, so it publishes its bootstrap
// symbols under the NativeDylibManager_* names. The class itself will be
// renamed to NativeDylibManager to match in a future cleanup.
- M[rt::sps_ci::NativeDylibManagerInstanceName] = ExecutorAddr::fromPtr(this);
- M[rt::sps_ci::DylibMgrOpen::Name] = ExecutorAddr::fromPtr(&openWrapper);
- M[rt::sps_ci::DylibMgrResolve::Name] = ExecutorAddr::fromPtr(&resolveWrapper);
+ M[Mangle.mangledCopy(rt::sps_ci::NativeDylibManagerInstanceName)] =
+ ExecutorAddr::fromPtr(this);
+ M[Mangle.mangledCopy(rt::sps_ci::DylibMgrOpen::Name)] =
+ ExecutorAddr::fromPtr(&openWrapper);
+ M[Mangle.mangledCopy(rt::sps_ci::DylibMgrResolve::Name)] =
+ ExecutorAddr::fromPtr(&resolveWrapper);
}
llvm::orc::shared::CWrapperFunctionBuffer
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
index 3f6ba5f56e5ee..ffbaf12987ca4 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
@@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/SimpleNativeMemoryMapSPSCI.h"
@@ -198,13 +201,18 @@ Error SimpleExecutorMemoryManager::shutdown() {
void SimpleExecutorMemoryManager::addBootstrapSymbols(
StringMap<ExecutorAddr> &M) {
+ Mangler Mangle{Triple(sys::getProcessTriple())};
namespace sps_ci = rt::sps_ci;
- M[sps_ci::SimpleNativeMemoryMapInstanceName] = ExecutorAddr::fromPtr(this);
- M[sps_ci::MemMgrReserve::Name] = ExecutorAddr::fromPtr(reserveWrapper);
- M[sps_ci::MemMgrInitialize::Name] = ExecutorAddr::fromPtr(initializeWrapper);
- M[sps_ci::MemMgrDeinitialize::Name] =
+ M[Mangle.mangledCopy(sps_ci::SimpleNativeMemoryMapInstanceName)] =
+ ExecutorAddr::fromPtr(this);
+ M[Mangle.mangledCopy(sps_ci::MemMgrReserve::Name)] =
+ ExecutorAddr::fromPtr(reserveWrapper);
+ M[Mangle.mangledCopy(sps_ci::MemMgrInitialize::Name)] =
+ ExecutorAddr::fromPtr(initializeWrapper);
+ M[Mangle.mangledCopy(sps_ci::MemMgrDeinitialize::Name)] =
ExecutorAddr::fromPtr(deinitializeWrapper);
- M[sps_ci::MemMgrRelease::Name] = ExecutorAddr::fromPtr(releaseWrapper);
+ M[Mangle.mangledCopy(sps_ci::MemMgrRelease::Name)] =
+ ExecutorAddr::fromPtr(releaseWrapper);
}
Expected<SimpleExecutorMemoryManager::SlabInfo &>
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
index de1e5a1a94a5a..7b91faf9ec1bb 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
@@ -7,8 +7,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#ifdef __APPLE__
#include <dlfcn.h>
@@ -106,18 +109,19 @@ bool UnwindInfoManager::TryEnable() {
}
void UnwindInfoManager::addBootstrapSymbols(StringMap<ExecutorAddr> &M) {
- M[rt_alt::UnwindInfoManagerRegisterActionName] =
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ M[Mangle.mangledCopy(rt_alt::UnwindInfoManagerRegisterActionName)] =
ExecutorAddr::fromPtr(llvm_orc_rt_alt_UnwindInfoManager_register);
- M[rt_alt::UnwindInfoManagerDeregisterActionName] =
+ M[Mangle.mangledCopy(rt_alt::UnwindInfoManagerDeregisterActionName)] =
ExecutorAddr::fromPtr(llvm_orc_rt_alt_UnwindInfoManager_deregister);
{
// Also provide symbols defined by StandaloneMachOUnwindInfoRegistrar
// in the new ORC runtime.
const auto &SNs = rt::orc_rt_MachOUnwindInfoRegistrarSPSSymbols;
- M[SNs.RegisterSectionsName] =
+ M[Mangle.mangledCopy(SNs.RegisterSectionsName)] =
ExecutorAddr::fromPtr(llvm_orc_rt_alt_UnwindInfoManager_register);
- M[SNs.DeregisterSectionsName] =
+ M[Mangle.mangledCopy(SNs.DeregisterSectionsName)] =
ExecutorAddr::fromPtr(llvm_orc_rt_alt_UnwindInfoManager_deregister);
}
}
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericDylibManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericDylibManagerTest.cpp
index 1f69990f39b88..c203d1e5e1ae0 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericDylibManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericDylibManagerTest.cpp
@@ -9,6 +9,9 @@
#include "OrcTestCommon.h"
#include "llvm/ExecutionEngine/Orc/EPCGenericDylibManagerSPS.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
@@ -35,9 +38,12 @@ TEST(EPCGenericDylibManagerTest, CreateFromExecutionSession) {
ExecutorAddr InstanceAddr(1), OpenAddr(2), ResolveAddr(3);
StringMap<ExecutorAddr> BootstrapSyms;
- BootstrapSyms[rt::sps_ci::NativeDylibManagerInstanceName] = InstanceAddr;
- BootstrapSyms[rt::sps_ci::DylibMgrOpen::Name] = OpenAddr;
- BootstrapSyms[rt::sps_ci::DylibMgrResolve::Name] = ResolveAddr;
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ BootstrapSyms[Mangle.mangledCopy(
+ rt::sps_ci::NativeDylibManagerInstanceName)] = InstanceAddr;
+ BootstrapSyms[Mangle.mangledCopy(rt::sps_ci::DylibMgrOpen::Name)] = OpenAddr;
+ BootstrapSyms[Mangle.mangledCopy(rt::sps_ci::DylibMgrResolve::Name)] =
+ ResolveAddr;
auto SSP = std::make_shared<SymbolStringPool>();
auto EPC =
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
index 1a3426ddf8dc8..54c4a745b1d9f 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
@@ -9,6 +9,9 @@
#include "OrcTestCommon.h"
#include "llvm/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerSPS.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
@@ -107,6 +110,7 @@ CWrapperFunctionBuffer testRelease(const char *ArgData, size_t ArgSize) {
TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
ExecutionSession ES(cantFail(SelfExecutorProcessControl::Create()));
+ MangleAndInterner Mangle(ES);
SimpleAllocator SA;
// Register the test wrappers in the bootstrap JITDylib under the default
@@ -114,17 +118,17 @@ TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
namespace sps_ci = rt::sps_ci;
auto Exported = JITSymbolFlags::Exported;
cantFail(ES.getBootstrapJITDylib().define(absoluteSymbols({
- {ES.intern(sps_ci::SimpleNativeMemoryMapInstanceName),
+ {Mangle(sps_ci::SimpleNativeMemoryMapInstanceName),
{ExecutorAddr::fromPtr(&SA), Exported}},
- {ES.intern(sps_ci::MemMgrReserve::Name),
+ {Mangle(sps_ci::MemMgrReserve::Name),
{ExecutorAddr::fromPtr(&testReserve), Exported}},
- {ES.intern(sps_ci::MemMgrInitialize::Name),
+ {Mangle(sps_ci::MemMgrInitialize::Name),
{ExecutorAddr::fromPtr(&testInitialize), Exported}},
// Deinitialize is part of the interface but unused here; the release
// wrapper (same signature) stands in so the proxy resolves.
- {ES.intern(sps_ci::MemMgrDeinitialize::Name),
+ {Mangle(sps_ci::MemMgrDeinitialize::Name),
{ExecutorAddr::fromPtr(&testRelease), Exported}},
- {ES.intern(sps_ci::MemMgrRelease::Name),
+ {Mangle(sps_ci::MemMgrRelease::Name),
{ExecutorAddr::fromPtr(&testRelease), Exported}},
})));
@@ -162,21 +166,22 @@ TEST(EPCGenericJITLinkMemoryManagerTest, CreateFromJITDylib) {
auto EPC =
std::make_unique<UnsupportedExecutorProcessControl>(std::move(SSP));
ExecutionSession ES(std::move(EPC));
+ MangleAndInterner Mangle(ES);
auto &JD = ES.createBareJITDylib("JD");
ExecutorAddr AllocatorAddr(1), ReserveAddr(2), InitAddr(3), DeinitAddr(4),
ReleaseAddr(5);
cantFail(JD.define(absoluteSymbols({
- {ES.intern(sps_ci::SimpleNativeMemoryMapInstanceName),
+ {Mangle(sps_ci::SimpleNativeMemoryMapInstanceName),
{AllocatorAddr, JITSymbolFlags::Exported}},
- {ES.intern(sps_ci::MemMgrReserve::Name),
+ {Mangle(sps_ci::MemMgrReserve::Name),
{ReserveAddr, JITSymbolFlags::Exported}},
- {ES.intern(sps_ci::MemMgrInitialize::Name),
+ {Mangle(sps_ci::MemMgrInitialize::Name),
{InitAddr, JITSymbolFlags::Exported}},
- {ES.intern(sps_ci::MemMgrDeinitialize::Name),
+ {Mangle(sps_ci::MemMgrDeinitialize::Name),
{DeinitAddr, JITSymbolFlags::Exported}},
- {ES.intern(sps_ci::MemMgrRelease::Name),
+ {Mangle(sps_ci::MemMgrRelease::Name),
{ReleaseAddr, JITSymbolFlags::Exported}},
})));
@@ -193,11 +198,12 @@ TEST(EPCGenericJITLinkMemoryManagerTest, CreateFailsOnMissingSymbol) {
auto EPC =
std::make_unique<UnsupportedExecutorProcessControl>(std::move(SSP));
ExecutionSession ES(std::move(EPC));
+ MangleAndInterner Mangle(ES);
auto &JD = ES.createBareJITDylib("JD");
// Only define the instance symbol; the wrapper symbols are missing.
cantFail(JD.define(absoluteSymbols({
- {ES.intern(sps_ci::SimpleNativeMemoryMapInstanceName),
+ {Mangle(sps_ci::SimpleNativeMemoryMapInstanceName),
{ExecutorAddr(1), JITSymbolFlags::Exported}},
})));
@@ -224,11 +230,14 @@ TEST(EPCGenericJITLinkMemoryManagerTest, CreateFromExecutionSession) {
ReleaseAddr(5);
StringMap<ExecutorAddr> BootstrapSyms;
- BootstrapSyms[sps_ci::SimpleNativeMemoryMapInstanceName] = AllocatorAddr;
- BootstrapSyms[sps_ci::MemMgrReserve::Name] = ReserveAddr;
- BootstrapSyms[sps_ci::MemMgrInitialize::Name] = InitAddr;
- BootstrapSyms[sps_ci::MemMgrDeinitialize::Name] = DeinitAddr;
- BootstrapSyms[sps_ci::MemMgrRelease::Name] = ReleaseAddr;
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ BootstrapSyms[Mangle.mangledCopy(sps_ci::SimpleNativeMemoryMapInstanceName)] =
+ AllocatorAddr;
+ BootstrapSyms[Mangle.mangledCopy(sps_ci::MemMgrReserve::Name)] = ReserveAddr;
+ BootstrapSyms[Mangle.mangledCopy(sps_ci::MemMgrInitialize::Name)] = InitAddr;
+ BootstrapSyms[Mangle.mangledCopy(sps_ci::MemMgrDeinitialize::Name)] =
+ DeinitAddr;
+ BootstrapSyms[Mangle.mangledCopy(sps_ci::MemMgrRelease::Name)] = ReleaseAddr;
auto SSP = std::make_shared<SymbolStringPool>();
auto EPC =
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
index 6c25cfb48d6c2..f1b11ee214e01 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
@@ -10,6 +10,7 @@
#include "llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
#include "llvm/ExecutionEngine/Orc/EPCGenericMemoryAccessSPS.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/MemoryAccessSPSCI.h"
#include "llvm/Testing/Support/Error.h"
@@ -126,40 +127,41 @@ class EPCGenericMemoryAccessTest : public testing::Test {
// resolves its proxies to them.
namespace sps_ci = rt::sps_ci;
auto Exported = JITSymbolFlags::Exported;
+ MangleAndInterner Mangle(*ES);
cantFail(ES->getBootstrapJITDylib().define(absoluteSymbols(
- {{ES->intern(sps_ci::MemWriteUInt8s::Name),
+ {{Mangle(sps_ci::MemWriteUInt8s::Name),
{ExecutorAddr::fromPtr(&testWriteUInts<tpctypes::UInt8Write,
SPSMemoryAccessUInt8Write>),
Exported}},
- {ES->intern(sps_ci::MemWriteUInt16s::Name),
+ {Mangle(sps_ci::MemWriteUInt16s::Name),
{ExecutorAddr::fromPtr(&testWriteUInts<tpctypes::UInt16Write,
SPSMemoryAccessUInt16Write>),
Exported}},
- {ES->intern(sps_ci::MemWriteUInt32s::Name),
+ {Mangle(sps_ci::MemWriteUInt32s::Name),
{ExecutorAddr::fromPtr(&testWriteUInts<tpctypes::UInt32Write,
SPSMemoryAccessUInt32Write>),
Exported}},
- {ES->intern(sps_ci::MemWriteUInt64s::Name),
+ {Mangle(sps_ci::MemWriteUInt64s::Name),
{ExecutorAddr::fromPtr(&testWriteUInts<tpctypes::UInt64Write,
SPSMemoryAccessUInt64Write>),
Exported}},
- {ES->intern(sps_ci::MemWritePointers::Name),
+ {Mangle(sps_ci::MemWritePointers::Name),
{ExecutorAddr::fromPtr(&testWritePointers), Exported}},
- {ES->intern(sps_ci::MemWriteBuffers::Name),
+ {Mangle(sps_ci::MemWriteBuffers::Name),
{ExecutorAddr::fromPtr(&testWriteBuffers), Exported}},
- {ES->intern(sps_ci::MemReadUInt8s::Name),
+ {Mangle(sps_ci::MemReadUInt8s::Name),
{ExecutorAddr::fromPtr(&testReadUInts<uint8_t>), Exported}},
- {ES->intern(sps_ci::MemReadUInt16s::Name),
+ {Mangle(sps_ci::MemReadUInt16s::Name),
{ExecutorAddr::fromPtr(&testReadUInts<uint16_t>), Exported}},
- {ES->intern(sps_ci::MemReadUInt32s::Name),
+ {Mangle(sps_ci::MemReadUInt32s::Name),
{ExecutorAddr::fromPtr(&testReadUInts<uint32_t>), Exported}},
- {ES->intern(sps_ci::MemReadUInt64s::Name),
+ {Mangle(sps_ci::MemReadUInt64s::Name),
{ExecutorAddr::fromPtr(&testReadUInts<uint64_t>), Exported}},
- {ES->intern(sps_ci::MemReadPointers::Name),
+ {Mangle(sps_ci::MemReadPointers::Name),
{ExecutorAddr::fromPtr(&testReadPointers), Exported}},
- {ES->intern(sps_ci::MemReadBuffers::Name),
+ {Mangle(sps_ci::MemReadBuffers::Name),
{ExecutorAddr::fromPtr(&testReadBuffers), Exported}},
- {ES->intern(sps_ci::MemReadStrings::Name),
+ {Mangle(sps_ci::MemReadStrings::Name),
{ExecutorAddr::fromPtr(&testReadStrings), Exported}}})));
MemAccess = cantFail(sps::createEPCGenericMemoryAccess(*ES));
diff --git a/llvm/unittests/ExecutionEngine/Orc/LookupAndApplyTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LookupAndApplyTest.cpp
index 08d454528e437..d358467990910 100644
--- a/llvm/unittests/ExecutionEngine/Orc/LookupAndApplyTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/LookupAndApplyTest.cpp
@@ -51,7 +51,7 @@ TEST(LookupAndApplyTest, EmptySearchOrderFailsEvenForWeakReference) {
ExecutorAddr A(AddrAValue);
EXPECT_THAT_ERROR(
lookupAndApply(LookupKind::Static, {},
- {recordAddr("addr_a", &A,
+ {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A,
SymbolLookupFlags::WeaklyReferencedSymbol)}),
Failed());
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
@@ -64,7 +64,8 @@ TEST(LookupAndApplyTest, RecordAddr) {
defineAddr(JD, "addr_a", ExecutorAddr(AddrAValue));
ExecutorAddr A;
- cantFail(lookupAndApply(JD, {recordAddr("addr_a", &A)}));
+ cantFail(
+ lookupAndApply(JD, {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A)}));
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
cantFail(ES.endSession());
@@ -76,7 +77,8 @@ TEST(LookupAndApplyTest, RecordAddrRequiredAbsentFails) {
ExecutorAddr A(AddrAValue);
EXPECT_THAT_ERROR(
- lookupAndApply(ES.getBootstrapJITDylib(), {recordAddr("absent", &A)}),
+ lookupAndApply(ES.getBootstrapJITDylib(),
+ {recordAddr(SymbolNameSpec::verbatim("absent"), &A)}),
Failed());
cantFail(ES.endSession());
@@ -88,9 +90,10 @@ TEST(LookupAndApplyTest, RecordAddrWeaklyReferencedAbsent) {
ExecutionSession ES(cantFail(SelfExecutorProcessControl::Create()));
ExecutorAddr A(AddrAValue);
- cantFail(lookupAndApply(
- ES.getBootstrapJITDylib(),
- {recordAddr("absent", &A, SymbolLookupFlags::WeaklyReferencedSymbol)}));
+ cantFail(
+ lookupAndApply(ES.getBootstrapJITDylib(),
+ {recordAddr(SymbolNameSpec::verbatim("absent"), &A,
+ SymbolLookupFlags::WeaklyReferencedSymbol)}));
EXPECT_EQ(A, ExecutorAddr());
cantFail(ES.endSession());
@@ -150,7 +153,8 @@ TEST(LookupAndApplyTest, MultiplePrepareFns) {
};
cantFail(lookupAndApply(
- JD, {recordAddr("addr_a", &A), recordAddr("addr_b", &B), RecordBoth}));
+ JD, {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A),
+ recordAddr(SymbolNameSpec::verbatim("addr_b"), &B), RecordBoth}));
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
EXPECT_EQ(B, ExecutorAddr(AddrBValue));
@@ -170,7 +174,8 @@ TEST(LookupAndApplyTest, NoApplyOnLookupFailure) {
ExecutorAddr A, B;
// "addr_a" resolves, "absent" does not, so the whole lookup fails.
EXPECT_THAT_ERROR(
- lookupAndApply(JD, {recordAddr("addr_a", &A), recordAddr("absent", &B)}),
+ lookupAndApply(JD, {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A),
+ recordAddr(SymbolNameSpec::verbatim("absent"), &B)}),
Failed());
EXPECT_EQ(A, ExecutorAddr());
EXPECT_EQ(B, ExecutorAddr());
@@ -188,7 +193,7 @@ TEST(LookupAndApplyTest, Async) {
std::promise<MSVCPError> P;
auto F = P.get_future();
lookupAndApply([&](Error Err) { P.set_value(std::move(Err)); }, JD,
- {recordAddr("addr_a", &A)});
+ {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A)});
EXPECT_THAT_ERROR(F.get(), Succeeded());
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
@@ -204,7 +209,7 @@ TEST(LookupAndApplyTest, AsyncFailure) {
std::promise<MSVCPError> P;
auto F = P.get_future();
lookupAndApply([&](Error Err) { P.set_value(std::move(Err)); }, JD,
- {recordAddr("absent", &A)});
+ {recordAddr(SymbolNameSpec::verbatim("absent"), &A)});
EXPECT_THAT_ERROR(F.get(), Failed());
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
@@ -220,9 +225,10 @@ TEST(LookupAndApplyTest, WeaklyReferencedMixed) {
ExecutorAddr A, B(AddrBValue);
cantFail(lookupAndApply(
- JD,
- {recordAddr("addr_a", &A, SymbolLookupFlags::WeaklyReferencedSymbol),
- recordAddr("absent", &B, SymbolLookupFlags::WeaklyReferencedSymbol)}));
+ JD, {recordAddr(SymbolNameSpec::verbatim("addr_a"), &A,
+ SymbolLookupFlags::WeaklyReferencedSymbol),
+ recordAddr(SymbolNameSpec::verbatim("absent"), &B,
+ SymbolLookupFlags::WeaklyReferencedSymbol)}));
EXPECT_EQ(A, ExecutorAddr(AddrAValue));
EXPECT_EQ(B, ExecutorAddr());
diff --git a/llvm/unittests/ExecutionEngine/Orc/ProxyTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ProxyTest.cpp
index 13393cee7eb60..bfd99f210cc17 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ProxyTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ProxyTest.cpp
@@ -17,6 +17,7 @@
#include "llvm/ExecutionEngine/Orc/Proxy.h"
#include "llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
#include "llvm/ExecutionEngine/Orc/LookupAndApply.h"
+#include "llvm/ExecutionEngine/Orc/Mangling.h"
#include "llvm/ExecutionEngine/Orc/RecordProxy.h"
#include "llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
#include "llvm/Support/MSVCErrorWorkarounds.h"
@@ -92,7 +93,7 @@ static_assert(
// A minimal ProxySpec-shaped type (static dispatch + Name) for exercising the
// recordProxy client path without depending on a protocol.
struct AddOneSpec {
- static constexpr const char *Name = "add_one";
+ static constexpr SymbolNameSpec Name = SymbolNameSpec::verbatim("add_one");
static void dispatch(unique_function<void(Expected<int32_t>)> OnComplete,
ExecutionSession &ES, ExecutorAddr Callee,
const int32_t &Arg) {
@@ -161,7 +162,7 @@ TEST(ProxyTest, RecordProxyWeaklyReferencedPresent) {
auto &JD = ES.getBootstrapJITDylib();
ExecutorAddr CalleeAddr = ExecutorAddr::fromPtr(addOne);
cantFail(
- JD.define(absoluteSymbols({{ES.intern(AddOneSpec::Name),
+ JD.define(absoluteSymbols({{MangleAndInterner(ES)(AddOneSpec::Name),
{CalleeAddr, JITSymbolFlags::Exported}}})));
AddOneProxy Call;
@@ -181,7 +182,7 @@ TEST(ProxyTest, RecordProxy) {
auto &JD = ES.getBootstrapJITDylib();
cantFail(JD.define(absoluteSymbols(
- {{ES.intern(AddOneSpec::Name),
+ {{MangleAndInterner(ES)(AddOneSpec::Name),
{ExecutorAddr::fromPtr(addOne), JITSymbolFlags::Exported}}})));
AddOneProxy Call;
@@ -202,7 +203,7 @@ TEST(ProxyTest, RecordProxyExplicitDispatch) {
auto &JD = ES.getBootstrapJITDylib();
cantFail(JD.define(absoluteSymbols(
- {{ES.intern(AddOneSpec::Name),
+ {{MangleAndInterner(ES)(AddOneSpec::Name),
{ExecutorAddr::fromPtr(addOne), JITSymbolFlags::Exported}}})));
AddOneProxy Call;
@@ -230,8 +231,9 @@ TEST(ProxyTest, RecordProxySpecNameOverride) {
{ExecutorAddr::fromPtr(addOne), JITSymbolFlags::Exported}}})));
AddOneProxy Call;
- cantFail(
- lookupAndApply(JD, {recordProxy<AddOneSpec>(&Call, "add_one_alias")}));
+ cantFail(lookupAndApply(
+ JD, {recordProxy<AddOneSpec>(
+ &Call, SymbolNameSpec::verbatim("add_one_alias"))}));
ASSERT_TRUE(static_cast<bool>(Call));
Expected<int32_t> R = Call(ES, 41);
@@ -264,12 +266,13 @@ TEST(ProxyTest, RecordProxySymbolStringPtrExplicitDispatch) {
auto &JD = ES.getBootstrapJITDylib();
cantFail(JD.define(absoluteSymbols(
- {{ES.intern(AddOneSpec::Name),
+ {{MangleAndInterner(ES)(AddOneSpec::Name),
{ExecutorAddr::fromPtr(addOne), JITSymbolFlags::Exported}}})));
AddOneProxy Call;
cantFail(lookupAndApply(
- JD, {recordProxy(&Call, AddOneDispatch, ES.intern(AddOneSpec::Name))}));
+ JD, {recordProxy(&Call, AddOneDispatch,
+ MangleAndInterner(ES)(AddOneSpec::Name))}));
ASSERT_TRUE(static_cast<bool>(Call));
Expected<int32_t> R = Call(ES, 41);
@@ -310,7 +313,7 @@ TEST(ProxyTest, RecordProxySymbolStringPtrWeaklyReferencedAbsent) {
AddOneProxy Call;
cantFail(lookupAndApply(
ES.getBootstrapJITDylib(),
- {recordProxy<AddOneSpec>(&Call, ES.intern(AddOneSpec::Name),
+ {recordProxy<AddOneSpec>(&Call, MangleAndInterner(ES)(AddOneSpec::Name),
SymbolLookupFlags::WeaklyReferencedSymbol)}));
EXPECT_FALSE(static_cast<bool>(Call));
diff --git a/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp b/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
index 8afc0dd0fad4b..de6c4cdb53fef 100644
--- a/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
@@ -11,9 +11,12 @@
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/ExecutionEngine/Orc/MemoryMapper.h"
#include "llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
+#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/ExecutionEngine/Orc/Shared/SPSCI/SharedMemoryMapperSPSCI.h"
#include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h"
+#include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
#include "llvm/Testing/Support/Error.h"
using namespace llvm;
@@ -48,11 +51,17 @@ TEST(SharedMemoryMapperTest, MemReserveInitializeDeinitializeRelease) {
{
StringMap<ExecutorAddr> Map;
MapperService.addBootstrapSymbols(Map);
- SAs.Instance = Map[rt::sps_ci::SharedMemoryMapperInstanceName];
- SAs.Reserve = Map[rt::sps_ci::SharedMemoryMapperReserve::Name];
- SAs.Initialize = Map[rt::sps_ci::SharedMemoryMapperInitialize::Name];
- SAs.Deinitialize = Map[rt::sps_ci::SharedMemoryMapperDeinitialize::Name];
- SAs.Release = Map[rt::sps_ci::SharedMemoryMapperRelease::Name];
+ Mangler Mangle{Triple(sys::getProcessTriple())};
+ SAs.Instance =
+ Map[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperInstanceName)];
+ SAs.Reserve =
+ Map[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperReserve::Name)];
+ SAs.Initialize =
+ Map[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperInitialize::Name)];
+ SAs.Deinitialize = Map[Mangle.mangledCopy(
+ rt::sps_ci::SharedMemoryMapperDeinitialize::Name)];
+ SAs.Release =
+ Map[Mangle.mangledCopy(rt::sps_ci::SharedMemoryMapperRelease::Name)];
}
std::string TestString = "Hello, World!";
More information about the llvm-commits
mailing list