This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][nfc] Use includeInSymtab for all symtab-skipping logic
ClosedPublic

Authored by int3 on Apr 8 2022, 7:26 PM.

Details

Summary

D123302: [lld/mac] Add some comments and asserts got me looking deeper at includeInSymtab. I thought it was a
little odd that there were excluded (live) symbols for which
includeInSymtab was false; we shouldn't have so many different ways to
exclude a symbol. As such, this diff makes the L-prefixed-symbol
exclusion code use includeInSymtab too. (Note that as part of our
support for __eh_frame, we will also be excluding all __eh_frame
symbols from the symtab in a future diff.)

Another thing I noticed is that the emitStabs code never has to deal
with excluded symbols because SymtabSection::finalize() already
filters them out. As such, I've updated the comments and asserts from
D123302: [lld/mac] Add some comments and asserts to reflect this.

Diff Detail

Event Timeline

int3 created this revision.Apr 8 2022, 7:26 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 8 2022, 7:26 PM
int3 requested review of this revision.Apr 8 2022, 7:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2022, 7:26 PM
thakis accepted this revision.Apr 10 2022, 6:37 PM
thakis added a subscriber: thakis.

Nice!

lld/MachO/ConcatOutputSection.cpp
333

For the lines that are just reformatted without changes, maybe commit those in a separate commit.

lld/MachO/SymbolTable.cpp
233

Doesn't this still make sense to explain the /*file=*/nullptr (instead of the isec->getFile() you'd expect -- or at least I expected that.)

239

I think this one is just reformatted without any other changes too (ie maybe put in separate commit)

This revision is now accepted and ready to land.Apr 10 2022, 6:37 PM
int3 marked 2 inline comments as done.Apr 11 2022, 12:07 PM
int3 added inline comments.
lld/MachO/ConcatOutputSection.cpp
333

oh yeah I had initially added the extra param to addDefined as well but removed it after, hence the formatting changes. will revert those

lld/MachO/SymbolTable.cpp
233

sure, I can leave it in. IMO it's conceivable that synthetic symbols could have an associated InputSection, but it's true that we don't create any of those at the moment

int3 updated this revision to Diff 422004.Apr 11 2022, 12:34 PM
int3 marked an inline comment as done.

address comments