[PATCH] [LLD] COFF: Define error categories for Driver, Reader and Resolver.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jun 1 05:47:55 PDT 2015


On 1 June 2015 at 04:26, Simon Atanasyan <simon at atanasyan.com> wrote:
> Just FYI
>
> MCLinker does not use error codes returning from function at all. In
> case of error/warning/etc you can print an appropriate message
> something like below. The "error manager" is responsible to print the
> message and to count number of errors, warnings, etc.
>
> [[
>     error(diag::error_Mips_abiflags_invalid_version) << version <<
> pInput.name();
> ]]
>
> The linker attempts to continue execution as much as possible but
> checks the number of reported errors in some critical points like
> after reading input files, after applying of relocations and of course
> at the end of execution. If there is an error the linker stops and
> returns non zero exit code.
>
> If you found a serious problem and need to stop execution immediately
> you can report fatal error. That causes calling of
> `llvm::sys::RunInterruptHandlers();` and then `exit(1)`.
>
> [[
>     fatal(diag::fatal_cannot_read_input) << pInput.path();
> ]]
>
> I think we can implement a similar approach in LLD.

Looks quite similar to the DiagnosticHandler in llvm.

Cheers,
Rafael



More information about the llvm-commits mailing list