We were fetching archive symbols too eagerly, bloating binary size as well as
just screwing up binaries that expected to look up certain symbols only at
runtime.
Details
- Reviewers
oontvoo - Group Reviewers
Restricted Project - Commits
- rG1b4436471498: [lld-macho] Unreferenced weak dylib symbols shouldn't fetch archive symbols
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lld/MachO/SymbolTable.cpp | ||
---|---|---|
193 | I wonder if this should be == RefState::Strong. can't find docs anywhere for MachO, but in ELF, it seems weak-ref doesn't trigger a fetch from an archive ... |
lld/MachO/SymbolTable.cpp | ||
---|---|---|
193 | good question. Turns out that for Mach-O, weak refs do trigger fetches. But I should have tested it :) adding one now |
Question: do all these tests match ld64 behavior? I think the weak-dylib condition is quite nice now because its rules are commutative.
## (Weak) archive symbols have the same precedence as dylib symbols.
Non-weak-dylib looks a bit odd as it is not commutative.
Non-weak-dylib looks a bit odd as it is not commutative.
Non-weak-dylib has the same precedence as archive symbols, so yeah, it's not commutative. This is what ld64 does too.
It took me a while to find the test that covered this case, so I put up D120938: [lld-macho][nfc] Rename some tests for consistency
I wonder if this should be == RefState::Strong.
can't find docs anywhere for MachO, but in ELF, it seems weak-ref doesn't trigger a fetch from an archive ...