[PATCH] D56941: Fix a bug that file size is sometimes silently rounded up to the page size.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 07:45:41 PST 2019


thakis added a comment.

It's a bit weird that allocateMappedMemory() returns a buffer whose size is larger than what's requested, but the method is explicitly documented as such: http://llvm-cs.pcc.me.uk/include/llvm/Support/Memory.h#64

I looked around a bit through callers and several others seem to get this wrong too, at least from a quick look (e.g. http://llvm-cs.pcc.me.uk/include/llvm/Support/BinaryByteStream.h#205 , used by MSFBuilder::commit() (http://llvm-cs.pcc.me.uk/lib/DebugInfo/MSF/MSFBuilder.cpp#347) -- unless that's supposed to write the extra data.

Did you look through callers and determined that the api as-is is the best compromise, or should we change the Memory::allocateMappedMemory() to set the requested size instead of the actual one?

(Having said that, I don't know this code well and I'm probably not the best person to review it.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56941/new/

https://reviews.llvm.org/D56941





More information about the llvm-commits mailing list