This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Don't emit stabs entries for functions folded during ICF
ClosedPublic

Authored by thakis on Apr 6 2022, 1:39 PM.

Details

Summary

This matches ld64, and makes dsymutil work better with lld's output.
Fixes PR54783, see there for details.

Reduces time needed to run dsymutil on Chromium Framework from 8m30s
(which is already down from 26 min with D123218) to 6m30s and removes
many lines of "could not find object file symbol for symbol" from dsymutil output
(previously: several MB of those messages, now dsymutil is completely silent).

Diff Detail

Event Timeline

thakis created this revision.Apr 6 2022, 1:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
thakis requested review of this revision.Apr 6 2022, 1:39 PM
thakis edited the summary of this revision. (Show Details)Apr 6 2022, 1:41 PM
thakis updated this revision to Diff 421067.Apr 6 2022, 7:16 PM

make test pass on windows

int3 accepted this revision.Apr 6 2022, 9:06 PM
int3 added a subscriber: int3.
int3 added inline comments.
lld/MachO/Symbols.cpp
104

How do you feel about doing this work in ConcatInputSection::foldIdentical instead? We already toggle ConcatInputSection::wasCoalesced there, so this would fit in nicely.

(We could also perform the canonicalization of Defined::isec there -- I'd previously put it here because InputSections didn't use to hold references to their symbols.)

lld/MachO/Symbols.h
148

nit: "with" suggests a symmetric relationship, "into" seems more apt to me

This revision is now accepted and ready to land.Apr 6 2022, 9:06 PM
thakis added inline comments.Apr 7 2022, 4:40 AM
lld/MachO/Symbols.cpp
104

Do you mean giving ConcatInputSection a bool for this and setting that bool instead of giving Defined a bit, and then querying defined->isec->wasIdenticalCodeFolded instead of defined->wasIdenticalCodeFolded? Or do you mean keeping the bit on Defined and make ConcatInputSection::foldIdentical walk symbols and set the bit on all the section's symbols?

thakis marked an inline comment as done.Apr 7 2022, 5:08 AM

Thanks!

lld/MachO/Symbols.cpp
104

Oh wait the former doesn't work, defined->isec is the canonical section.

So did the latter. LMK if that's not what you meant :)

Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 5:09 AM
int3 added inline comments.Apr 7 2022, 5:11 AM
lld/MachO/Symbols.cpp
104

I did mean the latter, but you got me pondering whether the former would work for a second :p

lgtm, thanks!