Skip to content

Commit 156e253

Browse files
authored
Revert "Rename F_no_mmap to F_mmap" (#134924)
Reverts #134787 Causes the LIT test `lld\test\ELF\link-open-file.test` to fail on the `llvm-clang-x86_64-sie-win` Build Bot. First instance of the failure observed in: https://lab.llvm.org/buildbot/#/builders/46/builds/14847
1 parent dbcde15 commit 156e253

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
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 ? (unsigned)FileOutputBuffer::F_mmap : 0;
1492+
ctx.arg.mmapOutputFile ? 0 : (unsigned)FileOutputBuffer::F_no_mmap;
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_mmap;
2911+
if (!ctx.arg.mmapOutputFile)
2912+
flags |= FileOutputBuffer::F_no_mmap;
29132913
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
29142914
FileOutputBuffer::create(ctx.arg.outputFile, fileSize, flags);
29152915

llvm/include/llvm/Support/FileOutputBuffer.h

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

34-
/// Use mmap for in-memory file buffer.
35-
F_mmap = 2,
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,
3637
};
3738

3839
/// 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_mmap)
189+
if (Flags & F_no_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_mmap);
126+
FileOutputBuffer::create(File5, 8000, FileOutputBuffer::F_no_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)