[PATCH] D34814: [ELF] - Fail the link if something happens on DWARF parsing stage of -gdb-index building

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 00:02:32 PDT 2017


>>-  DWARFContextInMemory Dwarf(*Obj.get());
>>+  DWARFContextInMemory Dwarf(*Obj.get(), nullptr, [&](Error E) {
>>+    error(toString(Sec->File) + ": error parsing DWARF data:\n>>> " +
>>+          toString(std::move(E)));
>>+    return ErrorPolicy::Continue;
>
>Is 'error(...)' a noreturn function (does it cause the linker to stop immediately?)? If so, remove the 'return' after it, since that'll be unreachable code.

No, we have fatal(...) which is noreturn, error(...) is just a regular reporting helper,
that continues execution and increases ErrorCount counter.
So this code intention is to report all errors from parser and LLD will fail the link later.

At the same time error reporting subsystem has error limit. I was wondering when wrote this patch
if I should do something like:

if (ErrorCount  >= Config->ErrorLimit)
  return ErrorPolicy::Halt;
error(toString(Sec->File) + ": error parsing DWARF data:\n>>> " +
    toString(std::move(E)));
return ErrorPolicy::Continue;

George.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170711/973edb1d/attachment.html>


More information about the llvm-commits mailing list