Index: COFF/Writer.cpp =================================================================== --- COFF/Writer.cpp +++ COFF/Writer.cpp @@ -187,6 +187,8 @@ C->setRVA(Off); C->OutputSectionOff = Off; Off += C->getSize(); + if (Off > UINT32_MAX) + fatal("section larger than 4 GiB: " + Name); Header.VirtualSize = Off; if (C->hasData()) Header.SizeOfRawData = alignTo(Off, SectorSize);