[llvm] [ORC] Add default visibility to required JIT functions (PR #86322)
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 11:27:00 PDT 2024
https://github.com/keith created https://github.com/llvm/llvm-project/pull/86322
If you build LLVM with `-DCMAKE_CXX_VISIBILITY_PRESET=hidden` to help reduce binary size, these symbols end up becoming local, and getting stripped. This forces default visibility to override the global setting in that case.
Relevant: https://github.com/llvm/llvm-project/issues/62815#issuecomment-1560078260
>From 830de731e794f0b19f707c4ed57a4343893293df Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Fri, 22 Mar 2024 11:24:16 -0700
Subject: [PATCH] [ORC] Add default visibility to required JIT functions
If you build LLVM with `-DCMAKE_CXX_VISIBILITY_PRESET=hidden` to help
reduce binary size, these symbols end up becoming local, and getting
stripped. This forces default visibility to override the global setting
in that case.
Relevant: https://github.com/llvm/llvm-project/issues/62815#issuecomment-1560078260
---
llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index 8a4145a6b02a26..fe9fc1228bfc0c 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -31,6 +31,7 @@ struct jit_descriptor __jit_debug_descriptor = {JitDescriptorVersion, 0,
// Debuggers that implement the GDB JIT interface put a special breakpoint in
// this function.
+LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code() {
// The noinline and the asm prevent calls to this function from being
// optimized out.
@@ -74,7 +75,7 @@ static void appendJITDebugDescriptor(const char *ObjAddr, size_t Size) {
__jit_debug_descriptor.action_flag = JIT_REGISTER_FN;
}
-extern "C" orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ATTRIBUTE_VISIBILITY_DEFAULT orc::shared::CWrapperFunctionResult
llvm_orc_registerJITLoaderGDBAllocAction(const char *Data, size_t Size) {
using namespace orc::shared;
return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
@@ -90,7 +91,7 @@ llvm_orc_registerJITLoaderGDBAllocAction(const char *Data, size_t Size) {
.release();
}
-extern "C" orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ATTRIBUTE_VISIBILITY_DEFAULT orc::shared::CWrapperFunctionResult
llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size) {
using namespace orc::shared;
return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
More information about the llvm-commits
mailing list