[llvm] 085e21b - [llvm-jitlink] Explicit exports for builtin runtime functions in MinGW executables (#107375)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 04:25:34 PST 2025


Author: Stefan Gränitz
Date: 2025-02-14T13:25:30+01:00
New Revision: 085e21b8326ef2327ee6082930e63d9e127eb06c

URL: https://github.com/llvm/llvm-project/commit/085e21b8326ef2327ee6082930e63d9e127eb06c
DIFF: https://github.com/llvm/llvm-project/commit/085e21b8326ef2327ee6082930e63d9e127eb06c.diff

LOG: [llvm-jitlink] Explicit exports for builtin runtime functions in MinGW executables (#107375)

Use explicit exports to fix the symbol resolution part of
https://github.com/llvm/llvm-project/issues/98714 in MinGW

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index e337fe5f99865..d15b858c6c9a9 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(WIN32)
+  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(WIN32)


        


More information about the llvm-commits mailing list