forked from OSchip/llvm-project
[ThinLTO/gold] Avoid race with cache pruner by copying to temp files
Summary: This will avoid the race condition described in the review for D37993. I believe that the Path parameter to AddBufferFn is no longer utilized. I would prefer to remove that as a follow up clean up patch to reduce the diffs in this patch. Reviewers: pcc Reviewed By: pcc Subscribers: inglorion, llvm-commits Differential Revision: https://reviews.llvm.org/D43396 llvm-svn: 325618
This commit is contained in:
parent
42bcec7d38
commit
b145cca85e
|
@ -54,10 +54,16 @@
|
|||
; This should remove it.
|
||||
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
|
||||
; RUN: --plugin-opt=thinlto \
|
||||
; RUN: --plugin-opt=save-temps \
|
||||
; RUN: --plugin-opt=cache-dir=%t.cache \
|
||||
; RUN: --plugin-opt=cache-policy=cache_size_bytes=32k:prune_interval=0s \
|
||||
; RUN: -o %t3.o %t2.o %t.o
|
||||
; RUN: -o %t4.o %t2.o %t.o
|
||||
; RUN: ls %t.cache | count 4
|
||||
; With save-temps we can confirm that the cached files were copied into temp
|
||||
; files to avoid a race condition with the cached files being pruned, since the
|
||||
; gold plugin-api only accepts native objects passed back as files.
|
||||
; RUN: ls %t4.o.o1
|
||||
; RUN: ls %t4.o.o2
|
||||
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
|
|
@ -919,9 +919,7 @@ static ld_plugin_status allSymbolsReadHook() {
|
|||
|
||||
auto AddBuffer = [&](size_t Task, std::unique_ptr<MemoryBuffer> MB,
|
||||
StringRef Path) {
|
||||
// Note that this requires that the memory buffers provided to AddBuffer are
|
||||
// backed by a file.
|
||||
Filenames[Task] = Path;
|
||||
*AddStream(Task)->OS << MB->getBuffer();
|
||||
};
|
||||
|
||||
NativeObjectCache Cache;
|
||||
|
|
Loading…
Reference in New Issue