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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 11:23:22 PDT 2017


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)




More information about the llvm-commits mailing list