[PATCH] D43820: [ELF] - Check that output sections fit in address space.

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 14:12:27 PDT 2018


espindola accepted this revision.
espindola added a comment.
This revision is now accepted and ready to land.

LGTM with nits.



================
Comment at: ELF/Writer.cpp:1995
+    bool Overflow = OS->Addr + OS->Size < OS->Addr;
+    if (!Config->Is64)
+      Overflow |= OS->Addr + OS->Size > UINT32_MAX;
----------------
This is templated on ELFT, may as well use it.

It might be cleaner to write this as one check
(OS->Addr + OS->Size < OS->Addr) || (!ELF::Is64Bits && OS->Addr + OS->Size > UINT32_MAX)



https://reviews.llvm.org/D43820





More information about the llvm-commits mailing list