Skip to content

Commit 81f9ff1

Browse files
committed
[ORC] Switch to new visibility macros for JIT debug symbols
Use LLVM_ALWAYS_EXPORT for __jit_debug_descriptor and __jit_debug_register_code so there exported even if LLVM is not built as a shared library. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows #109483.
1 parent 6d6287a commit 81f9ff1

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "llvm/ExecutionEngine/JITSymbol.h"
1212
#include "llvm/Support/BinaryStreamReader.h"
13+
#include "llvm/Support/Compiler.h"
1314
#include "llvm/Support/FormatVariadic.h"
1415

1516
#include <cstdint>
@@ -26,13 +27,13 @@ extern "C" {
2627
// We put information about the JITed function in this global, which the
2728
// debugger reads. Make sure to specify the version statically, because the
2829
// debugger checks the version before we can set it during runtime.
29-
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
30+
LLVM_ALWAYS_EXPORT
3031
struct jit_descriptor __jit_debug_descriptor = {JitDescriptorVersion, 0,
3132
nullptr, nullptr};
3233

3334
// Debuggers that implement the GDB JIT interface put a special breakpoint in
3435
// this function.
35-
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
36+
LLVM_ALWAYS_EXPORT
3637
LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code() {
3738
// The noinline and the asm prevent calls to this function from being
3839
// optimized out.

llvm/tools/lli/lli.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include "llvm/Object/Archive.h"
5151
#include "llvm/Object/ObjectFile.h"
5252
#include "llvm/Support/CommandLine.h"
53+
#include "llvm/Support/Compiler.h"
5354
#include "llvm/Support/Debug.h"
5455
#include "llvm/Support/DynamicLibrary.h"
5556
#include "llvm/Support/Format.h"
@@ -751,7 +752,7 @@ int main(int argc, char **argv, char * const *envp) {
751752

752753
// JITLink debug support plugins put information about JITed code in this GDB
753754
// JIT Interface global from OrcTargetProcess.
754-
extern "C" struct jit_descriptor __jit_debug_descriptor;
755+
extern "C" LLVM_ABI struct jit_descriptor __jit_debug_descriptor;
755756

756757
static struct jit_code_entry *
757758
findNextDebugDescriptorEntry(struct jit_code_entry *Latest) {

llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h"
1818
#include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h"
1919
#include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h"
20+
#include "llvm/Support/Compiler.h"
2021
#include "llvm/Support/Debug.h"
2122
#include "llvm/Support/DynamicLibrary.h"
2223
#include "llvm/Support/Error.h"
@@ -117,7 +118,7 @@ int openListener(std::string Host, std::string PortStr) {
117118

118119
// JITLink debug support plugins put information about JITed code in this GDB
119120
// JIT Interface global from OrcTargetProcess.
120-
extern "C" struct jit_descriptor __jit_debug_descriptor;
121+
extern "C" LLVM_ABI struct jit_descriptor __jit_debug_descriptor;
121122

122123
static void *findLastDebugDescriptorEntryPtr() {
123124
struct jit_code_entry *Last = __jit_debug_descriptor.first_entry;

0 commit comments

Comments
 (0)