diff options
| author | Fangrui Song <i@maskray.me> | 2024-09-21 09:35:01 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2024-09-21 09:35:01 -0700 |
| commit | 0f57d5e19a1a9fe617a3513163a7777f0bf5dea5 (patch) | |
| tree | 423269cd0c2be55fbf7662ca3cf2d5c6f3cf498f /lld/ELF/LTO.cpp | |
| parent | 18225c783a00bde62f19a177a57de388e20c2bba (diff) | |
| download | llvm-users/MaskRay/spr/elf-add-thinlto-index.zip llvm-users/MaskRay/spr/elf-add-thinlto-index.tar.gz llvm-users/MaskRay/spr/elf-add-thinlto-index.tar.bz2 | |
[𝘀𝗽𝗿] initial versionusers/MaskRay/spr/elf-add-thinlto-index
Created using spr 1.3.5-bogner
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; |
