This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] Skip computation of the undefined symbols references that are not shown
ClosedPublic

Authored by saudi on Jul 9 2020, 2:30 PM.

Details

Summary

The "undefined symbol" error message from lld-link displays up to 3 references to that symbol, and the number of extra references not shown.

This patch removes the computation of the strings for those extra references.

It fixes a freeze of lld-link we accidentally encountered, when we tried activating asan on one of our games without linking with the asan library.
In that case, __asan_report_load8 was referenced more than 2 million times, causing the computation of that many display strings, of which only 3 were used.

Diff Detail

Event Timeline

saudi created this revision.Jul 9 2020, 2:30 PM
mstorsjo accepted this revision.Jul 9 2020, 2:41 PM

LGTM (but maybe wait for a bit to see if someone else might have more opinions)

FWIW, I think this codepath exists in a fairly similar form in the ELF backend, that might benefit from a similar optimization.

This revision is now accepted and ready to land.Jul 9 2020, 2:41 PM
saudi updated this revision to Diff 277044.Jul 10 2020, 8:10 AM

Updated the test, adding an LTO obj file.

Still looks good with the additional test update (thanks for that!)

LGTM (but maybe wait for a bit to see if someone else might have more opinions)

FWIW, I think this codepath exists in a fairly similar form in the ELF backend, that might benefit from a similar optimization.

I double-checked, the corresponding code in ELF computes the strings in the same loop where they are displayed, instead of the 2 passes done for COFF.
So, no optimization seems necessary in the case of ELF.

LGTM (but maybe wait for a bit to see if someone else might have more opinions)

FWIW, I think this codepath exists in a fairly similar form in the ELF backend, that might benefit from a similar optimization.

I double-checked, the corresponding code in ELF computes the strings in the same loop where they are displayed, instead of the 2 passes done for COFF.
So, no optimization seems necessary in the case of ELF.

Oh, ok, that sounds good then. Please go ahead with this (and I think this could be worthwhile to backport to the release branch).

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2020, 9:17 PM
MaskRay added inline comments.
lld/test/COFF/Inputs/undefined-symbol-multi-lto.ll
20

llvm.ident should normally be removed.