[llvm] [llvm-jitlink] Explicit exports for builtin runtime functions in MinGW executables (PR #107375)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 05:39:29 PDT 2024
https://github.com/weliveindetail updated https://github.com/llvm/llvm-project/pull/107375
>From 0abf9ec89799d913f534c4e8986d85bbe918a113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Wed, 4 Sep 2024 15:14:03 +0200
Subject: [PATCH 1/2] [llvm-jitlink] Export builtin runtime functions from
MinGW executables
---
llvm/tools/llvm-jitlink/CMakeLists.txt | 27 ++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index e337fe5f998656..c2790616e01927 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -37,3 +37,30 @@ endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket)
endif()
+
+if(MINGW)
+ set(builtin_runtime_functions
+ llvm_orc_registerEHFrameSectionWrapper
+ llvm_orc_deregisterEHFrameSectionWrapper
+ llvm_orc_registerJITLoaderGDBWrapper
+ llvm_orc_registerJITLoaderGDBAllocAction
+ llvm_orc_registerJITLoaderPerfStart
+ llvm_orc_registerJITLoaderPerfEnd
+ llvm_orc_registerJITLoaderPerfImpl
+ llvm_orc_registerVTuneImpl
+ llvm_orc_unregisterVTuneImpl
+ llvm_orc_test_registerVTuneImpl
+ )
+
+ foreach(entry IN LISTS builtin_runtime_functions)
+ string(APPEND exports_multiline "${entry}\n")
+ endforeach()
+
+ set(file_stem ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llvm-jitlink)
+ file(WRITE ${file_stem}.symbols ${exports_multiline})
+ file(WRITE ${file_stem}.def "EXPORTS\n${exports_multiline}")
+
+ add_llvm_symbol_exports(llvm-jitlink ${file_stem}.symbols)
+else()
+ export_executable_symbols(llvm-jitlink)
+endif(MINGW)
>From de3480321bc4ff69f1d4cac416413a7e9124ad5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Fri, 6 Sep 2024 14:29:32 +0200
Subject: [PATCH 2/2] Generalize explicit exports to all WIN32 targets
---
llvm/tools/llvm-jitlink/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index c2790616e01927..d15b858c6c9a91 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -38,7 +38,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket)
endif()
-if(MINGW)
+if(WIN32)
set(builtin_runtime_functions
llvm_orc_registerEHFrameSectionWrapper
llvm_orc_deregisterEHFrameSectionWrapper
@@ -63,4 +63,4 @@ if(MINGW)
add_llvm_symbol_exports(llvm-jitlink ${file_stem}.symbols)
else()
export_executable_symbols(llvm-jitlink)
-endif(MINGW)
+endif(WIN32)
More information about the llvm-commits
mailing list