[ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.
authorLang Hames <lhames@gmail.com>
Mon, 19 Jul 2021 23:06:39 +0000 (09:06 +1000)
committerLang Hames <lhames@gmail.com>
Tue, 20 Jul 2021 01:30:54 +0000 (11:30 +1000)
This macro can be used to define tag variables for use with jit-dispatch.

compiler-rt/lib/orc/common.h
compiler-rt/lib/orc/macho_platform.cpp

index 5038425..54e613e 100644 (file)
 #include "compiler.h"
 #include <type_traits>
 
+/// 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 {};
 
index c9792f3..8a3f8d9 100644 (file)
@@ -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.