This is an archive of the discontinued LLVM Phabricator instance.

[Support] Add in memory flag for FileOutputBuffer
AbandonedPublic

Authored by terrelln on Oct 21 2019, 8:38 PM.

Details

Reviewers
MaskRay
ruiu
Summary

Adds a flag F_in_memory to prefer in-memory output buffers over on-disk
output buffers.

We need this to support -no-mmap-output-file in LLD. LLD currently
explicitly ignores this flag for compatibility with the GNU linker.

Test Plan:

ninja check-llvm

Event Timeline

terrelln created this revision.Oct 21 2019, 8:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2019, 8:38 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
terrelln edited reviewers, added: ruiu; removed: rui314.Oct 21 2019, 8:39 PM
ruiu added a comment.Oct 22 2019, 11:32 AM

Could you explain a little bit about the motivation to add -no-mmap-output-file option to lld?

ruiu added inline comments.Oct 22 2019, 11:50 AM
llvm/include/llvm/Support/FileOutputBuffer.h
36–37

Technically mmap'ed files are also in memory (and on disk at the same time), so this comment might be a bit misleading. I'd name this F_no_mmap and explain that option as "Don't use mmap and instead write a in-memory buffer to a file when this buffer is closed".

ruiu added a comment.Oct 22 2019, 11:58 AM

Maybe this should be merged with https://reviews.llvm.org/D69294. Since we are moving to a single repository that contains both llvm and lld, we no longer have to split a commit at svn repo boundaries. Since this flag will be used only by lld at least for a while, it feels more natural to commit this and the other one as a single commit.

Maybe this should be merged with https://reviews.llvm.org/D69294. Since we are moving to a single repository that contains both llvm and lld, we no longer have to split a commit at svn repo boundaries. Since this flag will be used only by lld at least for a while, it feels more natural to commit this and the other one as a single commit.

Personally I like splitting up the diff by component so it is easier to search the git history of a file. But I'm happy to combine them, so I'll go ahead and do that.

terrelln abandoned this revision.Oct 24 2019, 6:02 PM

Merged into D69294