This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Move SymbolUnion size assertion to source file
ClosedPublic

Authored by smeenai on Apr 19 2022, 1:51 PM.

Details

Summary

Otherwise it fires for every single file which includes the header,
which is very noisy when building.

Diff Detail

Event Timeline

smeenai created this revision.Apr 19 2022, 1:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2022, 1:51 PM
smeenai requested review of this revision.Apr 19 2022, 1:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2022, 1:51 PM
peter.smith accepted this revision.Apr 21 2022, 3:10 AM

This looks sensible to me. If the size of SymbolUnion is changed then Symbols.cpp will be recompiled so we'll always get the assertion if it is only changed.

lld/ELF/Symbols.h
478

I think it will be worth moving the majority of the comment here as this is where someone will look when trying to modify SymbolUnion.

For example:

// It is important to keep the size of SymbolUnion small for performance and
// memory usage reasons. 64 bytes is a soft limit based on the size of Defined
// on a 64-bit system. This is enforced by a static_assert in Symbols.cpp.

Not a strong opinion, just a suggestion.

This revision is now accepted and ready to land.Apr 21 2022, 3:10 AM
MaskRay accepted this revision.Apr 21 2022, 2:56 PM
smeenai updated this revision to Diff 424348.Apr 21 2022, 6:03 PM

Address review comment and move other asserts

smeenai marked an inline comment as done.Apr 21 2022, 6:04 PM
smeenai added inline comments.
lld/ELF/Symbols.h
478

Good idea, thanks. I also belatedly noticed that the other assertions would have the same issue, so I moved them as well.

This revision was landed with ongoing or failed builds.Apr 22 2022, 4:45 PM
This revision was automatically updated to reflect the committed changes.
smeenai marked an inline comment as done.