[llvm] e984c2b - Revert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 3 13:52:10 PST 2021


Author: Stefan Gränitz
Date: 2021-03-03T22:35:36+01:00
New Revision: e984c2b06f0c59265ba2172bbdb2811c72123701

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

LOG: Revert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix

This reverts commit 900f076113302e26e1939541b546b0075e3e9721 and attempts an actual fix: All failing tests for llvm-jitlink use the `-noexec` flag. The inputs they operate on are not meant for execution on the host system. Looking e.g. at the MachO_test_harness_harnesss.s test, llvm-mc generates input machine code with "x86_64-apple-macosx10.9".

My previous attempt in bbdb4c8c9bcef0e8db751630accc04ad874f54e7 disabled the debug support plugin for Windows targets, but what we would actually want is to disable it on Windows HOSTS.

With the new patch here, I don't do exactly that, but instead follow the approach for the EH frame plugin and include the `-noexec` flag in the condition. It should have the desired effect when it comes to the test suite. It appears a little workaround'ish, but should work reliably for now. I will discuss the issue with Lang and see if we can do better. Thanks @thakis again for the temporary fix.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/CMakeLists.txt
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp
    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 34e892f30ed6..8d511b17fca2 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -24,16 +24,4 @@ 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/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 0a2ff8088dbe..13d139024213 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -848,13 +848,12 @@ Session::Session(std::unique_ptr<TargetProcessControl> TPC, Error &Err)
     return;
   }
 
-  if (!NoExec && !this->TPC->getTargetTriple().isOSWindows())
+  if (!NoExec && !this->TPC->getTargetTriple().isOSWindows()) {
     ObjLayer.addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
         ES, ExitOnErr(TPCEHFrameRegistrar::Create(*this->TPC))));
-
-  if (!this->TPC->getTargetTriple().isOSWindows())
     ObjLayer.addPlugin(std::make_unique<DebugObjectManagerPlugin>(
         ES, ExitOnErr(createJITLoaderGDBRegistrar(*this->TPC))));
+  }
 
   ObjLayer.addPlugin(std::make_unique<JITLinkSessionPlugin>(*this));
 

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


        


More information about the llvm-commits mailing list