Just enough to consume some bitcode files and link them. There's more
to be done around the symbol resolution API and the LTO config, but I don't yet
understand what all the various LTO settings do...
Details
- Reviewers
compnerd smeenai MaskRay - Group Reviewers
Restricted Project - Commits
- rG21f831134c90: [lld-macho] Add very basic support for LTO
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Out of curiosity: are going to add distributed thinlto?
e.g. https://reviews.llvm.org/D46034
lld/MachO/Driver.cpp | ||
---|---|---|
322–323 | Why not write this as: if (Optional<DylibFile *> dylib = makeDylibFromTAPI(mbref)) newFile = *dylib; | |
332–333 | LLVM style generally does not compare against nullptr or NULL. | |
lld/MachO/LTO.cpp | ||
41 | Could we not just do a .reserve on the std::vector on L37 and then do an emplace_back on the vector and use a range based for loop, and avoid the unnecessary construction and replacement of the resolutions? |
@tschuett we'll want to implement that eventually, but it's not a priority. Thanks for the pointer to that diff!
lld/MachO/LTO.cpp | ||
---|---|---|
74 | This needs a test file with more than one input file. |
lld/MachO/LTO.cpp | ||
---|---|---|
74 | I actually did try doing that (with 2 files), but it appears that the ltoObj compiled both of them in the same thread. Any idea how to get it to deterministically use more than 1? |
MachO/CMakeLists.txt needs 3 dependencies LTO/MC/Passes otherwise it will fail to build in -DBUILD_SHARED_LIBS=on mode due to -Wl,-z,defs
lld/MachO/LTO.cpp | ||
---|---|---|
74 | Ah, partitions is a ThinLTO concept. You'll need opt -module-summary a.ll -o a.o instead of llvm-as |
address comments
lld/MachO/LTO.cpp | ||
---|---|---|
74 | Thanks for the pointer! I've added the test, let me know if it looks right |
fix
lld/test/MachO/lto-save-temps.ll | ||
---|---|---|
11 | it would be nice to check that the other temp files *don't* exist, but I'm not sure how to do that in a cross-platform way in llvm-lit |
Why not write this as: