[PATCH] D13989: This removes the eating of the error in Archive::Child::getSize() when the charactersin the size field in the archive header for the member is not a number.

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 12:49:55 PST 2015


>> A broken .o/.a file is a really rare occurrence.
>
> Not for me.  As a developer of object file tools I often find myself trying to figure out why a binary is broken.  Having tools that simply give up and not print any data I personally don’t find useful.

Or me, but I don't think we are common enough that we should design for it :-)

When starting the new lld I was running gdb on dynamic linkers and
reading kernel code to figure out why they would reject the lld
produced files. Given how often new linkers get written, that is
pretty reasonable.

> Often times it is a disk has filled up and a file got truncated in a build.

That is a bug in the generator. It should be doing a rename once the
entire file has been fully written to disk. If you ever see a llvm
tools that is not doing that please report a bug.

>> Given that it is a really uncommon case, I think we should make the
>> handling in tools as simple as possible: if at all possible, just
>> exit(1).
>
> Again I respect your opinion.  But I disagree. Most of my time is spent looking at things that are broken.  Things that work and are correct I spend very little time with.

You can print a good error message and I encourage you too, but if so:

* The code should still look something like

std::string niceAndDescriptiveError = compute it in some way...
fail(niceAndDescriptiveError); // this will not return.

* If we need a nice error, it is a feature. If it is a feature we
should test for it.

Cheers,
Rafael


More information about the llvm-commits mailing list