[PATCH] D18041: [ELF] use fatal() instead of llvm_unreachable when performing relaxations.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 08:37:55 PST 2016


On 10 March 2016 at 11:28, George Rimar <grimar at accesssoftek.com> wrote:
> grimar added a comment.
>
> In http://reviews.llvm.org/D18041#371932, @rafael wrote:
>
>> fatal should only be used if this is actually reachable. Can you write
>>  a testcase that shows that you can reach each of these?
>>
>> Cheers,
>> Rafael
>
>
> I think existence of such test would mean a bug in lld.

In which case that is exactly what assert/llvm_unreachable are for.

> But we have fatal() in void X86_64TargetInfo::relocateOne() for example, I also don't sure we can write a test for that.

It should be possible with at .o with an invalid reloc number, no?

So the summary is that if you can reach something without a bug, that
should be a fatal/error. If getting there is a a bug, it should be
llvm_unreachable.

Cheers,
Rafael


More information about the llvm-commits mailing list