[all-commits] [llvm/llvm-project] f2f1e6: [BOLT] Make sure temp object file is always written

Job Noorman via All-commits all-commits at lists.llvm.org
Tue Jul 11 00:35:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f2f1e670b097f3e46b82222b6e5a69a6207a9e88
      https://github.com/llvm/llvm-project/commit/f2f1e670b097f3e46b82222b6e5a69a6207a9e88
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M bolt/lib/Rewrite/RewriteInstance.cpp

  Log Message:
  -----------
  [BOLT] Make sure temp object file is always written

BOLT used `ToolOutputFile::keep` to make sure the intermediary object
file was written to disk for debugging purposes when `--keep-tmp` was
passed. However, since and intermediary `buffer_ostream` was used to
stream to, and this class only writes to its output stream in its
destructor, the object file was lost whenever its destructor wouldn't
run. This could happen, for example, if there is a crash while linking.

This patch makes sure the object file is written to disk immediately
after we're done creating it. This is very useful while debugging
JITLink crashes. This patch also gets rid of creating a temporary file
when `--keep-tmp` is not passed by streaming the object file directly to
a `SmallString`.

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D154826




More information about the All-commits mailing list