[PATCH] D27712: [ELF] - Do not crash when move location counter backward.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 04:25:30 PST 2016

grimar added inline comments.

Comment at: ELF/LinkerScript.cpp:467-469
+      uintX_t Val = AssignCmd->Expression(Dot);
+      if (Val < Dot)
+        error("unable to move location counter backward for: " + CurOutSec->Name);
grimar wrote:
> ruiu wrote:
> > If `Dot` overflows towards negative, your expression cannot detect the error because `Val` would be a very large number. Can you handle this case as well?
> I'll update the patch tomorrow for that case.
After reviewing this I think:
1) This patch should be landed separatelly as it fix specific common case which is not related to overflows.
2) For case of overflow I suggest to use something like CheckedType from D25279 in expressions for all Expr we have. That makes overflow handling to be general and avoids point fixes.


More information about the llvm-commits mailing list