[PATCH] D115055: [Support] Use final filename for Caching buffer identifier
Leonard Grey via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 3 11:13:25 PST 2021
lgrey created this revision.
lgrey added reviewers: tejohnson, thakis.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a reviewer: JDevlieghere.
lgrey requested review of this revision.
Herald added a project: LLVM.
Mach-O LLD uses the buffer identifier of the memory buffer backing an object file to generate stabs which are used by `dsymutil` to find the object file for dSYM generation.
When using thinLTO, these buffers are provided by the cache which initially saves them to disk as temporary files beginning with "Thin-" but renames them to persistent files beginning with "llvmcache-" before the buffer is provided to the cache user.
However, the buffer is created before the file is renamed and is given the temp file's name as an identifier. This causes the generated stabs to point to nonexistent files.
This change names the buffer with the eventual persistent filename. I think this is safe because failing to rename the temp file is a fatal error.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115055
Files:
llvm/lib/Support/Caching.cpp
Index: llvm/lib/Support/Caching.cpp
===================================================================
--- llvm/lib/Support/Caching.cpp
+++ llvm/lib/Support/Caching.cpp
@@ -99,7 +99,7 @@
// Open the file first to avoid racing with a cache pruner.
ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
MemoryBuffer::getOpenFile(
- sys::fs::convertFDToNativeFile(TempFile.FD), TempFile.TmpName,
+ sys::fs::convertFDToNativeFile(TempFile.FD), EntryPath,
/*FileSize=*/-1, /*RequiresNullTerminator=*/false);
if (!MBOrErr)
report_fatal_error(Twine("Failed to open new cache file ") +
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115055.391673.patch
Type: text/x-patch
Size: 672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211203/90051f8f/attachment.bin>
More information about the llvm-commits
mailing list