This is an archive of the discontinued LLVM Phabricator instance.

[Support] Allow FileOutputBuffer::create to create an empty file
ClosedPublic

Authored by MaskRay on May 4 2020, 10:10 AM.

Details

Summary

Size==0 triggers assert(Size != 0) in mapped_file_region::init.
I plan to use an empty file in D79339 (llvm-objcopy --dump-section).

According to POSIX, "If len is zero, mmap() shall fail and no mapping
shall be established." Just specialize case Size=0 to use
createInMemoryBuffer.

Diff Detail

Event Timeline

MaskRay created this revision.May 4 2020, 10:10 AM
This revision is now accepted and ready to land.May 5 2020, 12:16 AM
This revision was automatically updated to reflect the committed changes.