[llvm] 900f076 - hack to unbreak check-llvm on win after https://reviews.llvm.org/D97335

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 15:11:52 PST 2021


Author: Nico Weber
Date: 2021-03-02T18:10:28-05:00
New Revision: 900f076113302e26e1939541b546b0075e3e9721

URL: https://github.com/llvm/llvm-project/commit/900f076113302e26e1939541b546b0075e3e9721
DIFF: https://github.com/llvm/llvm-project/commit/900f076113302e26e1939541b546b0075e3e9721.diff

LOG: hack to unbreak check-llvm on win after https://reviews.llvm.org/D97335

fix attempt http://reviews.llvm.org/rGbbdb4c8c9bcef0e didn't work

The problem is that the test tries to look up
llvm_orc_registerJITLoaderGDBWrapper from the llvm-jitlink.exe
executable, but the symbol wasn't exported. Just manually export it
for now. There's a FIXME with a suggestion for a real fix.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/CMakeLists.txt
    llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index 8d511b17fca2..34e892f30ed6 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -24,4 +24,16 @@ add_llvm_tool(llvm-jitlink
   llvm-jitlink-macho.cpp
   )
 
+# export_executable_symbols() is a no-op on Windows if neither
+# LLVM_EXPORTED_SYMBOL_FILE nor LLVM_EXPORT_SYMBOLS_FOR_PLUGINS are set, but
+# the jitlink tests need llvm_orc_registerJITLoaderGDBWrapper to be exported
+# from the executable to work.
+# FIXME: Find a better workaround. Maybe this should use LLVM_EXPORTED_SYMBOL_FILE
+# and an .exports file now that the binary has a required export.
+if (WIN32)
+  target_link_options(llvm-jitlink PRIVATE
+    "/export:llvm_orc_registerJITLoaderGDBWrapper"
+    )
+endif()
+
 export_executable_symbols(llvm-jitlink)

diff  --git a/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn
index 8ac9274bc36e..ea31b68d46ca 100644
--- a/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn
@@ -15,7 +15,9 @@ executable("llvm-jitlink") {
     "llvm-jitlink-macho.cpp",
     "llvm-jitlink.cpp",
   ]
-  if (host_os != "mac" && host_os != "win") {
+  if (host_os == "win") {
+    ldflags = [ "/export:llvm_orc_registerJITLoaderGDBWrapper" ]
+  } else if (host_os != "mac") {
     # Corresponds to export_executable_symbols() in cmake.
     ldflags = [ "-rdynamic" ]
   }


        


More information about the llvm-commits mailing list