[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:31:48 PDT 2024


https://github.com/keith updated https://github.com/llvm/llvm-project/pull/86322

>From 30e751460bef9d39407523fa576ed3c39af25601 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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index 8a4145a6b02a26..7529d9cef67ed5 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -26,11 +26,13 @@ extern "C" {
 // We put information about the JITed function in this global, which the
 // debugger reads.  Make sure to specify the version statically, because the
 // debugger checks the version before we can set it during runtime.
+LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 struct jit_descriptor __jit_debug_descriptor = {JitDescriptorVersion, 0,
                                                 nullptr, nullptr};
 
 // 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.



More information about the llvm-commits mailing list