[all-commits] [llvm/llvm-project] 8eafd9: [Support] Set `OF_Delete` for `InMemoryBuffer`'s c...
Douglas via All-commits
all-commits at lists.llvm.org
Fri May 16 06:41:08 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8eafd93034063971f08a06faa7a75a616b9866b6
https://github.com/llvm/llvm-project/commit/8eafd93034063971f08a06faa7a75a616b9866b6
Author: Douglas <Douglas.Gliner at sony.com>
Date: 2025-05-16 (Fri, 16 May 2025)
Changed paths:
M lld/test/ELF/link-open-file.test
M llvm/lib/Support/FileOutputBuffer.cpp
Log Message:
-----------
[Support] Set `OF_Delete` for `InMemoryBuffer`'s call to `openFileForWrite` under `commit` (#140109)
https://github.com/llvm/llvm-project/pull/134787 unintentionally enabled
`--mmap-output-file` by default under LLD which caused the Windows-only
test `lld\test\ELF\link-open-file.test` to fail. This failure uncovered
what appears to be an inconsistency on Windows between
`createOnDiskBuffer` and `createInMemoryBuffer` with respect to `DELETE`
access for the output file.
The output file created by `createOnDiskBuffer` sets the flag
`OF_Delete` as part of `fs::TempFile::create` while the output file
created by `createInMemoryBuffer` sets `OF_None` under
`InMemoryBuffer::commit`.
The test `lld\test\ELF\link-open-file.test` ensures that if
`FILE_SHARE_DELETE` is _not_ specified for an output file that LLD is
expected to overwrite, LLD should fail. This only happens if: "the file
or device has been opened for delete access" which is only done for
`fs::TempFile::create`.
See
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#FILE_SHARE_DELETE.
Therefore, I propose setting `OF_Delete` for `InMemoryBuffer::commit`'s
call to `openFileForWrite` to stay consistent with
`fs::TempFile::create`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list