This is an archive of the discontinued LLVM Phabricator instance.

Replace SharedSymbols with Defined when creating copy relocations
ClosedPublic

Authored by espindola on Apr 25 2018, 10:19 PM.

Details

Reviewers
ruiu
grimar
Summary

This is slightly easier to read IMHO.

The main motivation is that with this a SharedSymbol doen't need a section, which reduces the size of SymbolUnion.

Diff Detail

Event Timeline

espindola created this revision.Apr 25 2018, 10:19 PM

This seems makes things slightly simpler, so LGTM. Suggestions are below.

ELF/Relocations.cpp
470

I would shorten this with something like:

Symbol Old = Sym;
...
Sym.GotPltIndex = Old.GotPltIndex;
...
539–540

Maybe inline replaceWithDefined? These 2 lines look a bit lonely here. I would either inline or move them to replaceWithDefined.

grimar accepted this revision.Apr 26 2018, 2:34 AM
This revision is now accepted and ready to land.Apr 26 2018, 2:34 AM
espindola edited the summary of this revision. (Show Details)

Rebased and address some of the review comments.

This now move SharedSymbol from 80 to 72 bytes and Defined stays at 72.

With this the peak allocation when linking chromium goes from 568.1 to 564.2 MB.

espindola added inline comments.Apr 26 2018, 10:51 AM
ELF/Relocations.cpp
539–540

We need replaceWithDefined for copy relocations and canonical plt entries, so I don't think we should inline it.

While these two lines are only needed when handling alias to copy relocated entries, they probably don't cause an harm if moved to replaceWithDefined. I will experiment with that.

Implement the remaining suggestions.

ruiu accepted this revision.Apr 26 2018, 11:01 AM

LGTM

Nice! I actually once tried to do the same thing but didn't succeed. It's nice to see you made it!

ELF/Relocations.cpp
464

Please write a function comment to explain that a copy-relocated shared symbol is virtually the same as a defined symbol in a BSS section, so we replace the symbol as such.