This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Fix incorrect exit status bug exposed by D38283
AcceptedPublic

Authored by bd1976llvm on Sep 29 2017, 5:53 AM.

Details

Reviewers
ruiu
Summary

Despite emitting an error the return code is 0 if we can not write to the output file.

https://reviews.llvm.org/D38283 meant that we are now hitting this case.

Diff Detail

Event Timeline

bd1976llvm created this revision.Sep 29 2017, 5:53 AM
ruiu accepted this revision.Sep 29 2017, 12:42 PM

LGTM

ELF/Writer.cpp
247–250

error indeed increments ErrorCount, but the code seems to be unnecessarily indirect. I think I prefer

if (auto EC = Buffer->commit()) {
  error(...);
  return;
}
This revision is now accepted and ready to land.Sep 29 2017, 12:42 PM