Add support for thinlto option ( thinlto-emit-imports-files) to emit import files for thinlink.
Details
- Reviewers
pcc ruiu • espindola - Commits
- rG4fb5119215f8: Add support for thinlto option ( thinlto-emit-imports-files) to emit import…
rLLD331696: Add support for thinlto option ( thinlto-emit-imports-files) to emit import…
rL331696: Add support for thinlto option ( thinlto-emit-imports-files) to emit import…
Diff Detail
- Repository
- rL LLVM
Event Timeline
lld/ELF/LTO.cpp | ||
---|---|---|
102 ↗ | (On Diff #145057) | I don't understand this part of code. I think OS will be closed at end of this if block, so I don't think you are writing anything to the file. Is this code correct? |
lld/ELF/LTO.cpp | ||
---|---|---|
102 ↗ | (On Diff #145057) | For all the bitcode files, empty import files are generated at first. For the files selected by the linker having summary, lto::createWriteIndexesThinBackend overwrites the imports files . However, for the files which are either not selected by linker or they don't have summary, we don't write anything to .imports file since they don't import anything. These files are required for distributed ThinLTO build file staging. |
Added test to ensure that lld doesn't generate import files when thinlto-index-only is not enabled
lld/ELF/LTO.cpp | ||
---|---|---|
105 ↗ | (On Diff #145084) | failed to write -> cannot open for consistency with other error messages. |
102 ↗ | (On Diff #145057) | Got it. Let's factor it out as a separate function static void createEmptyFile(const Twine &Path); that creates an empty file at a given path. That should make things clear. |
Added createEmptyFile function to create empty import files. Also updated the test with error description.
I need to make similar change while creating empty index files, along with updating the description in test for it. I will add that change in next patch if that is okay.
I will be sending another patch to address tejohnson's concerns. I think, in the meantime, we can add emit-imports option support. Or would you like me to send that patch first?