Since there is no "weak lazy" lookup, function calls to weak symbols are
always non-lazily bound. We emit both regular non-lazy bindings as well
as weak bindings, in order that the weak bindings may overwrite the
non-lazy bindings if an appropriate symbol is found at runtime. However,
the bound addresses will still be written (non-lazily) into the
LazyPointerSection.
Details
- Reviewers
smeenai - Group Reviewers
Restricted Project - Commits
- rGe263287c797f: [lld-macho] Implement weak binding for branch relocations
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM
lld/MachO/Arch/X86_64.cpp | ||
---|---|---|
32 | Out of curiosity, what makes us need the explicit macho:: qualifier here? | |
lld/MachO/Symbols.h | ||
67 | Nit: add a newline before this, to separate it from the block of gotIndex and its comment. | |
lld/test/MachO/weak-binding.s | ||
103 | If I'm understanding the code correctly, a weak non-external function would behave the same as a weak external function (i.e. it would get a weak binding entry), which is different from non-external data. Is that intended, and either way, could you add a test? | |
lld/test/MachO/weak-definition-order.s | ||
28–30 | Do we also wanna check the weak bind entries? |
lld/MachO/Arch/X86_64.cpp | ||
---|---|---|
32 | it appears to be conflicting with llvm::object::Archive::Symbol. I didn't look into why it started conflicting in this diff and not before... | |
lld/test/MachO/weak-binding.s | ||
103 | nope... weak non-externals cannot be coalesced at runtime. I'm not sure the weak flag does anything meaningful to internal symbols actually... will add the test | |
lld/test/MachO/weak-definition-order.s | ||
28–30 | the weak bind info doesn't include the dylib name, so it won't tell us which symbol got priority here |
lld/test/MachO/weak-binding.s | ||
---|---|---|
103 | oh, yeah, I see what you're saying now -- my code doesn't actually implement that properly 😅 |
Out of curiosity, what makes us need the explicit macho:: qualifier here?