From e45cab4d4c6691c94296141531e6166fc5179f2d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 2 Mar 2021 18:10:25 -0500 Subject: [PATCH] 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. --- tools/llvm-jitlink/CMakeLists.txt | 12 ++++++++++++ utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/llvm-jitlink/CMakeLists.txt b/tools/llvm-jitlink/CMakeLists.txt index 8d511b17fca..34e892f30ed 100644 --- a/tools/llvm-jitlink/CMakeLists.txt +++ b/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/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn b/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn index 8ac9274bc36..ea31b68d46c 100644 --- a/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn +++ b/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" ] }