Created
January 3, 2019 17:29
-
-
Save rui314/836cc9dab97922271b63dba3d1d5a3f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp | |
index ca44581780e4..e55939bf8ed5 100644 | |
--- a/lld/ELF/LTO.cpp | |
+++ b/lld/ELF/LTO.cpp | |
@@ -275,20 +275,23 @@ std::vector<InputFile *> BitcodeCompiler::compile() { | |
if (!Config->ThinLTOCacheDir.empty()) | |
pruneCache(Config->ThinLTOCacheDir, Config->ThinLTOCachePolicy); | |
- std::vector<InputFile *> Ret; | |
- for (unsigned I = 0; I != MaxTasks; ++I) { | |
- if (Buf[I].empty()) | |
- continue; | |
- if (Config->SaveTemps) { | |
- if (I == 0) | |
- saveBuffer(Buf[I], Config->OutputFile + ".lto.o"); | |
- else | |
- saveBuffer(Buf[I], Config->OutputFile + Twine(I) + ".lto.o"); | |
- } | |
- InputFile *Obj = createObjectFile(MemoryBufferRef(Buf[I], "lto.tmp")); | |
- Ret.push_back(Obj); | |
+ if (!Config->LTOObjPath.empty()) { | |
+ saveBuffer(Buf[0], Config->LTOObjPath); | |
+ for (unsigned I = 1; I != MaxTasks; ++I) | |
+ saveBuffer(Buf[I], Config->LTOObjPath + Twine(I)); | |
+ } | |
+ | |
+ if (Config->SaveTemps) { | |
+ saveBuffer(Buf[0], Config->OutputFile + ".lto.o"); | |
+ for (unsigned I = 1; I != MaxTasks; ++I) | |
+ saveBuffer(Buf[I], Config->OutputFile + Twine(I) + ".lto.o"); | |
} | |
+ std::vector<InputFile *> Ret; | |
+ for (unsigned I = 0; I != MaxTasks; ++I) | |
+ if (!Buf[I].empty()) | |
+ Ret.push_back(createObjectFile(MemoryBufferRef(Buf[I], "lto.tmp"))); | |
+ | |
for (std::unique_ptr<MemoryBuffer> &File : Files) | |
if (File) | |
Ret.push_back(createObjectFile(*File)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment