We use DWARFContextInMemory for 2 purposes currently in LLD.
- To report error line number when reporting errors.
I noticed in AVR patch (at one of moments during reviews) that we had undefined error
and DWARF context reported multiple issues like "relocation is not supported" or something like
that. That happens because there is no support for AVR relocations on parsers side.
I guess result of working with such object in unexpected and since LLD looks at some point where
there is chance to see even more new targets probably, I think we should fatal().
- For .gdb_index building. Currently we have PR33173 and
"failed to compute relocation: R_X86_64_DTPOFF32 with --gdb-index". But also may have any other different errors,
like error of decompression of section or anything else because of broken object for example. That is true for
first case as well. And even now when looks that single relocation fail does not affect on index, it still wrong
not to fail in this case. That what was suggested in D33673 thread.
Also one benefit that we can fail early ar parsers side and do not wait for all section to be proccessed.
I'll post change for LLVM side shortly and update note with reference.