diff options
Diffstat (limited to 'lld/ELF/LTO.cpp')
| -rw-r--r-- | lld/ELF/LTO.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index f339f1c..2398b36 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -197,6 +197,28 @@ BitcodeCompiler::BitcodeCompiler() { createConfig(), backend, config->ltoPartitions, ltoModes[config->ltoKind]); + // Write a remapping file for the final native link. Non-lazy bitcode files + // are mapped to native object files. If lazy bitcode files is a minimized + // bitcode, it cannot participate the final link. Print /dev/null to ignore + // it. + if (!ctx.arg.thinLTOIndex.empty()) { + if (auto os = openFile(ctx.arg.thinLTOIndex)) { + for (BitcodeFile *file : ctx.bitcodeFiles) { + StringRef nativeDir = ctx.arg.thinLTOPrefixReplaceNativeObject.empty() + ? ctx.arg.thinLTOPrefixReplaceNew + : ctx.arg.thinLTOPrefixReplaceNativeObject; + *os << file->getName() << '=' + << lto::getThinLTOOutputFile(replaceThinLTOSuffix(file->getName()), + ctx.arg.thinLTOPrefixReplaceOld, + nativeDir) + << '\n'; + } + for (BitcodeFile *file : ctx.lazyBitcodeFiles) + if (file->lazy) + *os << file->getName() << "=/dev/null\n"; + } + } + // Initialize usedStartStop. if (ctx.bitcodeFiles.empty()) return; |
