[PATCH] D42010: [LLD][COFF] Report error when file will exceed Windows maximum image size (4GB)

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 10:35:22 PST 2018


rnk added inline comments.


================
Comment at: tools/lld/COFF/Writer.cpp:303-305
+    fatal(formatv(
+        "image size ({0}) exceeds maximum allowable size ({1})",
+        FileSize, UINT32_MAX));
----------------
colden wrote:
> rnk wrote:
> > ruiu wrote:
> > > I believe you can do
> > > 
> > >  fatal("image size ("+ Twine(FileSize) + ") exceeds maximum allowable size (" + Twine(UINT32_MAX) + ")");
> > Apologies in advance for nit picking, but why not say something more human readable like "4GB"?
> No problem, I'm happy to entertain nits :)
> 
> If we do this, I think we should represent the current size in GB as well. Printing two numbers that are not directly comparable would drive me nuts as a user. Is there an easy conversion function for this somewhere, or should I just static_cast to float and divide by 1073741824?
Nevermind, I think comparability is a great reason to keep this as it is.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42010





More information about the llvm-commits mailing list