From 8afa4c40cb863bb12a61e593171c7aca8eb39a07 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 20 Jul 2021 09:06:39 +1000 Subject: [PATCH] [ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro. This macro can be used to define tag variables for use with jit-dispatch. --- compiler-rt/lib/orc/common.h | 6 ++++++ compiler-rt/lib/orc/macho_platform.cpp | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler-rt/lib/orc/common.h b/compiler-rt/lib/orc/common.h index 5038425..54e613e 100644 --- a/compiler-rt/lib/orc/common.h +++ b/compiler-rt/lib/orc/common.h @@ -17,6 +17,12 @@ #include "compiler.h" #include +/// This macro should be used to define tags that will be associated with +/// handlers in the JIT process, and call can be used to define tags f +#define ORC_RT_JIT_DISPATCH_TAG(X) \ +extern "C" char X; \ +char X = 0; + /// Opaque struct for external symbols. struct __orc_rt_Opaque {}; diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp index c9792f3..8a3f8d9 100644 --- a/compiler-rt/lib/orc/macho_platform.cpp +++ b/compiler-rt/lib/orc/macho_platform.cpp @@ -25,14 +25,9 @@ using namespace __orc_rt; using namespace __orc_rt::macho; // Declare function tags for functions in the JIT process. -extern "C" char __orc_rt_macho_get_initializers_tag; -char __orc_rt_macho_get_initializers_tag = 0; - -extern "C" char __orc_rt_macho_get_deinitializers_tag; -char __orc_rt_macho_get_deinitializers_tag = 0; - -extern "C" char __orc_rt_macho_symbol_lookup_tag; -char __orc_rt_macho_symbol_lookup_tag = 0; +ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_get_initializers_tag) +ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_get_deinitializers_tag) +ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_symbol_lookup_tag) // eh-frame registration functions. // We expect these to be available for all processes. -- 2.7.4