Skip to content

Commit

Permalink
[SOL] Fix bug in LLD
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Steuernagel <[email protected]>
  • Loading branch information
LucasSte committed Jan 30, 2024
1 parent 2cd201e commit ab276f3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lld/Common/ErrorHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ void ErrorHandler::flushStreams() {
errs().flush();
}

void ErrorHandler::handleEarlyExit() {
if (!exitEarly) {
cleanupCallback();
}
}

ErrorHandler &lld::errorHandler() { return context().e; }

void lld::error(const Twine &msg) { errorHandler().error(msg); }
Expand Down
1 change: 1 addition & 0 deletions lld/ELF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ bool link(ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,

elf::ctx.driver.linkerMain(args);

ctx->e.handleEarlyExit();
return errorCount() == 0;
}
} // namespace elf
Expand Down
1 change: 1 addition & 0 deletions lld/MachO/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
for (const auto &warning : missingAutolinkWarnings)
warn(warning);

ctx->e.handleEarlyExit();
return errorCount() == 0;
}
} // namespace macho
Expand Down
1 change: 1 addition & 0 deletions lld/include/lld/Common/ErrorHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class ErrorHandler {
raw_ostream &outs();
raw_ostream &errs();
void flushStreams();
void handleEarlyExit();

std::unique_ptr<llvm::FileOutputBuffer> outputBuffer;

Expand Down

0 comments on commit ab276f3

Please sign in to comment.