[lld] r187670 - Use report_fatal_error() instead of llvm_unreachable() to show broken input file error.

David Blaikie dblaikie at gmail.com
Fri Aug 2 14:32:29 PDT 2013


On Fri, Aug 2, 2013 at 2:13 PM, Rafael Espíndola
<rafael.espindola at gmail.com> wrote:
>> This really should return an error_code.  When lld is a library inside an app like an IDE, we don’t want to kill the whole app because of a malformed object file.
>
> No opinion about this particular error, but do we really want to use
> lld like that? As far as I can tell clang is not used like that. IDEs
> (and all build systems really) just for exec clang. Given that there
> are a lot more compile jobs than link jobs (and the clang driver forks
> to run clang -cc1), it is not clear that the savings for not doing a
> fork+exec for the linker would be noticeable.
>
> Second, http://llvm.org/docs/CodingStandards.html#assert-liberally has
> been in effect since forever, so even if all of lld and lib/Object are
> "perfect", the IDE would still have to fork+exec when doing LTO, since
> it seems almost impossible to change all of the middle end passes and
> code generators to avoid assert, llvm_unreachable and
> report_fatal_error.

It shouldn't have to - assert liberally isn't about error reporting,
it's about failing early when LLVM enters into an
unexpected/unplanned/undesigned state so we can fix bugs more easily.

Those are distinct from error cases based on external inputs that can
actually be broken/invalid/etc - those codepaths should never be
asserts & should go through some appropriate error reporting
mechanism.

>
>> -Nick
>
> Cheers,
> Rafael
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list