Apparently this is used in real programs. I've handled this by reusing
the logic we already have for branch (function call) relocations.
Details
- Reviewers
smeenai - Group Reviewers
Restricted Project - Commits
- rGc7c9776f7771: [lld-macho] Allow the entry symbol to be dynamically bound
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM. It's interesting that this is a thing.
lld/MachO/Writer.cpp | ||
---|---|---|
200 | Possible follow-up: I think this calculation is done in a bunch of places. Is there a nice place where a function for this calculation could live? |
lld/MachO/Writer.cpp | ||
---|---|---|
200 | it's not really identical with anything else -- I mean, there's another place where we do addr + stubsIndex * stubSize, but here we are calculating the file offset and not the address. There are also a bunch of other places where we multiply by WordSize (to index into __la_symbol_ptrs) instead of by stubSize. |
lld/MachO/Writer.cpp | ||
---|---|---|
200 | You're right; I didn't pay attention to the VA vs the file offset. |
Possible follow-up: I think this calculation is done in a bunch of places. Is there a nice place where a function for this calculation could live?