[compiler-rt] 8afa4c4 - [ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 19 18:34:27 PDT 2021
Author: Lang Hames
Date: 2021-07-20T11:30:54+10:00
New Revision: 8afa4c40cb863bb12a61e593171c7aca8eb39a07
URL: https://github.com/llvm/llvm-project/commit/8afa4c40cb863bb12a61e593171c7aca8eb39a07
DIFF: https://github.com/llvm/llvm-project/commit/8afa4c40cb863bb12a61e593171c7aca8eb39a07.diff
LOG: [ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.
This macro can be used to define tag variables for use with jit-dispatch.
Added:
Modified:
compiler-rt/lib/orc/common.h
compiler-rt/lib/orc/macho_platform.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/common.h b/compiler-rt/lib/orc/common.h
index 5038425f81d9..54e613ecb42e 100644
--- a/compiler-rt/lib/orc/common.h
+++ b/compiler-rt/lib/orc/common.h
@@ -17,6 +17,12 @@
#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 {};
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index c9792f3a7599..8a3f8d96300a 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.
More information about the llvm-commits
mailing list