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

This reverts commit 900f076113 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 bbdb4c8c9b 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.
This commit is contained in:
Stefan Gränitz 2021-03-03 22:29:43 +01:00
parent eec7f8f7b1
commit e984c2b06f
3 changed files with 3 additions and 18 deletions

View File

@ -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)

View File

@ -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));

View File

@ -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" ]
}