diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-06-12 09:05:48 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-06-12 09:05:48 +0200 |
commit | e50b11ceb81089fc32eac7614b66daef7119f620 (patch) | |
tree | c8f31cb90c557357965c84aedaf07393e91dbc8d | |
parent | e6f8658c72ad837e3cbd0df9b31ace9686c59048 (diff) |
Remove output if ld fails
This helps link.exe which leaves broken the output around.
-rw-r--r-- | build2/cc/link-rule.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 4e7ca9a..ce1a9f6 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -2032,6 +2032,13 @@ namespace build2 try_rmfile (relt, true); } + // Remove the target file if any of the subsequent (after ld) actions + // fail or if ld fails but does not clean up its mess (like link.exe). + // If we don't do that, then we will end up with a broken build that is + // up-to-date. + // + auto_rmfile rm (relt); + if (verb >= 2) print_process (args); else if (verb) @@ -2090,11 +2097,6 @@ namespace build2 throw failed (); } - // Remove the target file if any of the subsequent actions fail. If we - // don't do that, we will end up with a broken build that is up-to-date. - // - auto_rmfile rm (relt); - if (ranlib) { const process_path& rl (cast<process_path> (ranlib)); |