Some synthetic sections can be empty while still being needed, thus they
can't be removed by removeUnusedSyntheticSections(). Rename this member
function to more appropriate isNeeded() with the opposite meaning.
No functional change intended.
Paths
| Differential D59982
[ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with opposite meaning ClosedPublic Authored by MaskRay on Mar 29 2019, 12:35 AM.
Details Summary Some synthetic sections can be empty while still being needed, thus they No functional change intended.
Diff Detail
Event TimelineComment Actions I think renaming makes sense. Comment Actions
I did struggle with the choice between used() and needed() :) I chose needed() as I think needed is slightly stronger: used in a way that requires it to exist. As a non-native English speaker my interpretation may be inaccurate and I am open to other suggestions :) Comment Actions
We need a help then :) I added @jhenderson, hopefully, he has an opinion about what can be better here. Comment Actions
Thanks 😆 I think I like needed() more than used(), but either is probably valid. "needed" implies it is required, and is independent of its usage, which I think is probably the desired semantics (you could of course just use required instead, but needed is fine). - I could imagine an architecture where it is important to create specific synthetic section regardless of anything else in the ELF (e.g. nothing else might actually use that section within the link). By the way, since you're changing from empty(), whose name mirrors a common function name in the standard libraries, to something that isn't, you should probably make it into a verb phrase (i.e. isNeeded()), based on they style guide. MaskRay retitled this revision from [ELF] Rename SyntheticSection::empty to more appropriate needed() with opposite meaning to [ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with opposite meaning. Comment ActionsAdopt jhenderson's suggestion: needed -> isNeeded This revision is now accepted and ready to land.Apr 1 2019, 1:04 AM Closed by commit rL357377: [ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with… (authored by MaskRay). · Explain WhyApr 1 2019, 1:15 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 193053 lld/trunk/ELF/SyntheticSections.h
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/Writer.cpp
|