[lld] r298815 - Do not use assert to report broken input files.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 13:36:05 PDT 2017


My memory is a bit fuzzy, but I think this should be an assert.

The only way we can get here is if there is a gap in the pieces, and I
think the only way we can have on is if there is a bug in the
.eh_frame parsing logic.

Cheers,
Rafael



On 26 March 2017 at 14:23, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Sun Mar 26 13:23:22 2017
> New Revision: 298815
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298815&view=rev
> Log:
> Do not use assert to report broken input files.
>
> Modified:
>     lld/trunk/ELF/Relocations.cpp
>
> Modified: lld/trunk/ELF/Relocations.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=298815&r1=298814&r2=298815&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Relocations.cpp (original)
> +++ lld/trunk/ELF/Relocations.cpp Sun Mar 26 13:23:22 2017
> @@ -683,7 +683,11 @@ public:
>        ++I;
>      if (I == Size)
>        return Off;
> -    assert(P[I].InputOff <= Off && "Relocation not in any piece");
> +
> +    if (Off < P[I].InputOff) {
> +      error("relocation not in any piece");
> +      return -1;
> +    }
>
>      // Offset -1 means that the piece is dead (i.e. garbage collected).
>      if (P[I].OutputOff == -1)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list