@@ -777,11 +777,13 @@ void ThinLTOCodeGenerator::optimize(Module &TheModule) {
777
777
// / Write out the generated object file, either from CacheEntryPath or from
778
778
// / OutputBuffer, preferring hard-link when possible.
779
779
// / Returns the path to the generated file in SavedObjectsDirectoryPath.
780
- static std::string writeGeneratedObject (int count, StringRef CacheEntryPath,
781
- StringRef SavedObjectsDirectoryPath,
782
- const MemoryBuffer &OutputBuffer) {
780
+ std::string
781
+ ThinLTOCodeGenerator::writeGeneratedObject (int count, StringRef CacheEntryPath,
782
+ const MemoryBuffer &OutputBuffer) {
783
+ auto ArchName = TMBuilder.TheTriple .getArchName ();
783
784
SmallString<128 > OutputPath (SavedObjectsDirectoryPath);
784
- llvm::sys::path::append (OutputPath, Twine (count) + " .thinlto.o" );
785
+ llvm::sys::path::append (OutputPath,
786
+ Twine (count) + " ." + ArchName + " .thinlto.o" );
785
787
OutputPath.c_str (); // Ensure the string is null terminated.
786
788
if (sys::fs::exists (OutputPath))
787
789
sys::fs::remove (OutputPath);
@@ -845,8 +847,8 @@ void ThinLTOCodeGenerator::run() {
845
847
if (SavedObjectsDirectoryPath.empty ())
846
848
ProducedBinaries[count] = std::move (OutputBuffer);
847
849
else
848
- ProducedBinaryFiles[count] = writeGeneratedObject (
849
- count, " " , SavedObjectsDirectoryPath , *OutputBuffer);
850
+ ProducedBinaryFiles[count] =
851
+ writeGeneratedObject ( count, " " , *OutputBuffer);
850
852
}, count++);
851
853
}
852
854
@@ -963,8 +965,7 @@ void ThinLTOCodeGenerator::run() {
963
965
ProducedBinaries[count] = std::move (ErrOrBuffer.get ());
964
966
else
965
967
ProducedBinaryFiles[count] = writeGeneratedObject (
966
- count, CacheEntryPath, SavedObjectsDirectoryPath,
967
- *ErrOrBuffer.get ());
968
+ count, CacheEntryPath, *ErrOrBuffer.get ());
968
969
return ;
969
970
}
970
971
}
@@ -1021,7 +1022,7 @@ void ThinLTOCodeGenerator::run() {
1021
1022
return ;
1022
1023
}
1023
1024
ProducedBinaryFiles[count] = writeGeneratedObject (
1024
- count, CacheEntryPath, SavedObjectsDirectoryPath, *OutputBuffer);
1025
+ count, CacheEntryPath, *OutputBuffer);
1025
1026
}, IndexCount);
1026
1027
}
1027
1028
}
0 commit comments