Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cafec40

Browse files
author
git apple-llvm automerger
committed
Merge commit 'd6c8e8908d42' from llvm.org/main into next
2 parents 082b7f7 + d6c8e89 commit cafec40

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

lld/ELF/Arch/ARM.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ template <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
14891489
const uint64_t fileSize =
14901490
sectionHeaderOff + shnum * sizeof(typename ELFT::Shdr);
14911491
const unsigned flags =
1492-
ctx.arg.mmapOutputFile ? 0 : (unsigned)FileOutputBuffer::F_no_mmap;
1492+
ctx.arg.mmapOutputFile ? (unsigned)FileOutputBuffer::F_mmap : 0;
14931493
unlinkAsync(ctx.arg.cmseOutputLib);
14941494
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
14951495
FileOutputBuffer::create(ctx.arg.cmseOutputLib, fileSize, flags);

lld/ELF/Writer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2908,8 +2908,8 @@ template <class ELFT> void Writer<ELFT>::openFile() {
29082908
unsigned flags = 0;
29092909
if (!ctx.arg.relocatable)
29102910
flags |= FileOutputBuffer::F_executable;
2911-
if (!ctx.arg.mmapOutputFile)
2912-
flags |= FileOutputBuffer::F_no_mmap;
2911+
if (ctx.arg.mmapOutputFile)
2912+
flags |= FileOutputBuffer::F_mmap;
29132913
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
29142914
FileOutputBuffer::create(ctx.arg.outputFile, fileSize, flags);
29152915

llvm/include/llvm/Support/FileOutputBuffer.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ class FileOutputBuffer {
3131
/// Set the 'x' bit on the resulting file.
3232
F_executable = 1,
3333

34-
/// Don't use mmap and instead write an in-memory buffer to a file when this
35-
/// buffer is closed.
36-
F_no_mmap = 2,
34+
/// Use mmap for in-memory file buffer.
35+
F_mmap = 2,
3736
};
3837

3938
/// Factory method to create an OutputBuffer object which manages a read/write

llvm/lib/Support/FileOutputBuffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ FileOutputBuffer::create(StringRef Path, size_t Size, unsigned Flags) {
186186
case fs::file_type::regular_file:
187187
case fs::file_type::file_not_found:
188188
case fs::file_type::status_error:
189-
if (Flags & F_no_mmap)
189+
if (Flags & F_mmap)
190190
return createInMemoryBuffer(Path, Size, Mode);
191191
else
192192
return createOnDiskBuffer(Path, Size, Mode);

llvm/unittests/Support/FileOutputBufferTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ TEST(FileOutputBuffer, Test) {
123123
File5.append("/file5");
124124
{
125125
Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
126-
FileOutputBuffer::create(File5, 8000, FileOutputBuffer::F_no_mmap);
126+
FileOutputBuffer::create(File5, 8000, FileOutputBuffer::F_mmap);
127127
ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError()));
128128
std::unique_ptr<FileOutputBuffer> &Buffer = *BufferOrErr;
129129
// Start buffer with special header.

0 commit comments

Comments
 (0)