Add support for ThinLTO plugin option thinlto-object-suffix-replace

Differential Revision: https://reviews.llvm.org/D46608

llvm-svn: 332527
This commit is contained in:
Rumeet Dhindsa
2018-05-16 21:04:08 +00:00
parent f18009dbc6
commit d2eb089a0e
6 changed files with 81 additions and 2 deletions

View File

@@ -1032,9 +1032,13 @@ BitcodeFile::BitcodeFile(MemoryBufferRef MB, StringRef ArchiveName,
// this causes a collision which result in only one of the objects being
// taken into consideration at LTO time (which very likely causes undefined
// symbols later in the link stage).
std::string Path = MB.getBufferIdentifier().str();
if (Config->ThinLTOIndexOnly)
Path = updateSuffixInPath(MB.getBufferIdentifier());
MemoryBufferRef MBRef(
MB.getBuffer(),
Saver.save(ArchiveName + MB.getBufferIdentifier() +
Saver.save(ArchiveName + Path +
(ArchiveName.empty() ? "" : utostr(OffsetInArchive))));
Obj = CHECK(lto::InputFile::create(MBRef), this);