[PATCH] D28010: FileOutputBuffer: support non-mmap'able file.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 17:54:30 PST 2016


ruiu created this revision.
ruiu added a reviewer: rafael.
ruiu added a subscriber: llvm-commits.

Previously, FileOutputBuffer didn't work for non-mmap'able files, so
you cannot use that class for /dev/null for example. This patch fixes
the issue.

Now, before mmap'ing a file, it checks whether a given file is a regular
file or not. If it is a regular file, it uses mmap as before. If not, it
creates an internal buffer and write that buffer contents on commit().

This patch enables "-o /dev/null" for LLD. Previouly, it failed.


https://reviews.llvm.org/D28010

Files:
  lld/ELF/Writer.cpp
  lld/test/ELF/basic.s
  llvm/include/llvm/Support/FileOutputBuffer.h
  llvm/lib/Support/FileOutputBuffer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28010.82187.patch
Type: text/x-patch
Size: 11611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161221/9a91a996/attachment.bin>


More information about the llvm-commits mailing list