[lld] ee23f8b - [COFF] Remove a truncation assertion from setRVA

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu May 13 19:37:22 PDT 2021


Author: Reid Kleckner
Date: 2021-05-13T19:37:14-07:00
New Revision: ee23f8b36f2c620f54fe5cbd74cbf930cb67c6fb

URL: https://github.com/llvm/llvm-project/commit/ee23f8b36f2c620f54fe5cbd74cbf930cb67c6fb
DIFF: https://github.com/llvm/llvm-project/commit/ee23f8b36f2c620f54fe5cbd74cbf930cb67c6fb.diff

LOG: [COFF] Remove a truncation assertion from setRVA

LLD already produces a nice error message when sections exceed 4GB, and
this setRVA assertion causes LLD to crash instead of diagnosing the
error properly.

No test because we don't want slow tests that create 4GB files.

Added: 
    

Modified: 
    lld/COFF/Chunks.h

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h
index 4ecb371189a7a..bdd3faa179a8a 100644
--- a/lld/COFF/Chunks.h
+++ b/lld/COFF/Chunks.h
@@ -86,8 +86,8 @@ class Chunk {
   // can be stored with 32 bits.
   uint32_t getRVA() const { return rva; }
   void setRVA(uint64_t v) {
+    // This may truncate. The writer checks for overflow later.
     rva = (uint32_t)v;
-    assert(rva == v && "RVA truncated");
   }
 
   // Returns readable/writable/executable bits.


        


More information about the llvm-commits mailing list