Since we emit diagnostics for undefineds in Writer::scanRelocations()
and symbols referenced by -u flags aren't referenced by any relocations,
this needs some manual code (similar to the entry point).
Details
- Reviewers
int3 - Group Reviewers
Restricted Project - Commits
- rGe0b8604e5d3c: [lld/mac] Implement -u flag
Diff Detail
Event Timeline
lld/test/MachO/u.s | ||
---|---|---|
22 | Would be nice to check the interaction with .weak_reference |
lld/test/MachO/u.s | ||
---|---|---|
22 | As far as I understand, .weak_reference only affects which opcodes are written to the import bind FSA description and doesn't interact with symbol lookup. Are you thinking of -U instead of -u maybe? Or do you mean a test that checks if a -u resolved against a dylib pulls in the dylib (independent of weak_ref)? |
Since we emit diagnostics for undefineds in Writer::scanRelocations()
I've been wondering whether this is the right way to do it... in particular, we end up emitting one error message per relocation to an undefined, even if they all point to the same undefined. I made a brief attempt to scan the symbol table instead, but that creates spurious errors for things like .globl unused_and_undefined. I suppose we could always just dedup the symbols when scanning through the relocations though. Do you know how LLD-ELF handles this?
lld/test/MachO/u.s | ||
---|---|---|
22 | yeah I don't see how weak_reference would need to be tested here either |
For ELF, both linkers (GNU ld,gold,LLD) and loaders (glibc,musl,FreeBSD rtld,etc) report undefined symbols only when relocations are present.
Thanks for the pointers to the ELF diffs! I guess we'll implement deduplication in a similar way in the future.
lld/test/MachO/u.s | ||
---|---|---|
32 | nit: extra line |
Would be nice to check the interaction with .weak_reference