Skip to content

Commit

Permalink
Small fixes for LLVM AOT backend on Windows. (#3786)
Browse files Browse the repository at this point in the history
* Fix handling when IREE_LLVMAOT_LINKER_PATH is not set.

* Intentionally leak dylib libraries on exit when tracing.
  • Loading branch information
ScottTodd authored and benvanik committed Nov 18, 2020
1 parent 5c242c9 commit 61ad236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion iree/compiler/Dialect/HAL/Target/LLVM/AOT/LinkerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ void Artifacts::keepAllFiles() {
}

std::string LinkerTool::getToolPath() const {
return std::string(std::getenv("IREE_LLVMAOT_LINKER_PATH"));
char *linkerPath = std::getenv("IREE_LLVMAOT_LINKER_PATH");
if (linkerPath) {
return std::string(linkerPath);
} else {
return "";
}
}

LogicalResult LinkerTool::runLinkCommand(const std::string &commandLine) {
Expand Down
8 changes: 6 additions & 2 deletions iree/hal/dylib/dylib_executable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ DyLibExecutable::DyLibExecutable() = default;

DyLibExecutable::~DyLibExecutable() {
IREE_TRACE_SCOPE0("DyLibExecutable::dtor");
// TODO(benvanik): move to an atexit handler when tracing is enabled.
// executable_library_.release();
#if IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_INSTRUMENTATION
// Leak the library when tracing, since the profiler may still be reading it.
// TODO(benvanik): move to an atexit handler instead, verify with ASAN/MSAN
executable_library_.release();
#else
executable_library_.reset();
#endif // IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_INSTRUMENTATION
for (const auto& file_path : temp_file_paths_) {
file_io::DeleteFile(file_path).IgnoreError();
}
Expand Down

0 comments on commit 61ad236

Please sign in to comment.