This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Don't add names of unreferenced symbols to string table
ClosedPublic

Authored by thakis on Dec 22 2020, 8:04 AM.

Details

Summary

Before this, a hello world program would contain many many unnecessary
entries in its string table.

No behavior change, just makes the string table in the output smaller
and more like ld64's.

Diff Detail

Event Timeline

thakis requested review of this revision.Dec 22 2020, 8:04 AM
thakis created this revision.
compnerd accepted this revision.Dec 22 2020, 9:45 AM
compnerd added a subscriber: compnerd.

The change on L722 took me a few moments to catch - that was subtle.

lld/MachO/SyntheticSections.cpp
699

Why not emplace_back?

This revision is now accepted and ready to land.Dec 22 2020, 9:45 AM

Thanks!

lld/MachO/SyntheticSections.cpp
699

That's annoying to use with structs pre c++20 (https://stackoverflow.com/questions/13812703/c11-emplace-back-on-vectorstruct) and in practice it won't matter.

(But that's the retconned answer. The actual reason is that the LHS used push_back and I didn't think about it ;) )

Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2020, 1:02 PM