Loading lld/ELF/Writer.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -1635,10 +1635,12 @@ static void unlinkAsync(StringRef Path) { // Path as a new file. If we do that in a different thread, the new // thread can remove the new file. SmallString<128> TempPath; if (auto EC = sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath)) fatal(EC, "createUniqueFile failed"); if (auto EC = sys::fs::rename(Path, TempPath)) fatal(EC, "rename failed"); if (sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath)) return; if (sys::fs::rename(Path, TempPath)) { sys::fs::remove(TempPath); return; } // Remove TempPath in background. std::thread([=] { ::remove(TempPath.str().str().c_str()); }).detach(); Loading lld/test/ELF/basic.s +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ # RUN: ld.lld %t -o %t2 # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \ # RUN: | FileCheck %s # RUN: ld.lld %t -o /dev/null # exits with return code 42 on linux .globl _start Loading Loading
lld/ELF/Writer.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -1635,10 +1635,12 @@ static void unlinkAsync(StringRef Path) { // Path as a new file. If we do that in a different thread, the new // thread can remove the new file. SmallString<128> TempPath; if (auto EC = sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath)) fatal(EC, "createUniqueFile failed"); if (auto EC = sys::fs::rename(Path, TempPath)) fatal(EC, "rename failed"); if (sys::fs::createUniqueFile(Path + "tmp%%%%%%%%", TempPath)) return; if (sys::fs::rename(Path, TempPath)) { sys::fs::remove(TempPath); return; } // Remove TempPath in background. std::thread([=] { ::remove(TempPath.str().str().c_str()); }).detach(); Loading
lld/test/ELF/basic.s +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ # RUN: ld.lld %t -o %t2 # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \ # RUN: | FileCheck %s # RUN: ld.lld %t -o /dev/null # exits with return code 42 on linux .globl _start Loading