This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Make Bss and BssRelRo sections to be synthetic (#2).
AbandonedPublic

Authored by grimar on Mar 2 2017, 9:38 AM.

Details

Summary

In compare with D30458, this makes Bss/BssRelRo to be pure
synthetic sections.

That removes CopyRelSection class completely, making
Bss/BssRelRo to be just regular synthetics.

Diff Detail

Event Timeline

grimar created this revision.Mar 2 2017, 9:38 AM
ruiu added inline comments.Mar 2 2017, 9:50 AM
ELF/Relocations.cpp
488–492

Here is an idea. Can you overwrite the symbol body using replaceBody<> to change the type from SharedSymbol to DefinedSynthetic?

ELF/Symbols.h
233–234

Why do you need to aggregate these two members into a new struct?

grimar updated this revision to Diff 90681.Mar 6 2017, 5:07 AM
  • Addressed review comments.
ELF/Relocations.cpp
488–492

Done. I used DefinedRegular.

ruiu accepted this revision.Mar 6 2017, 6:26 AM

LGTM.

This is looking pretty good. Converting shared symbols to the regular symbols for copy relocations seems to simplify things. This change makes me think of using the same technique for other symbols. For example, we might want to convert DefinedCommon to DefinedRegular when a common symbol gets an address in .bss. Not sure if that'll work but should be worth trying.

ELF/Symbols.cpp
110

nit: I don't think a long line with the ternary operator is very easy to follow. Better to write it in three lines.

This revision is now accepted and ready to land.Mar 6 2017, 6:26 AM
This revision was automatically updated to reflect the committed changes.
grimar updated this revision to Diff 91329.Mar 10 2017, 6:35 AM
  • Looks reason of PR32167 (AArch64 LLD buildbot broken) was a lost of symbol version information after conversion from SharedSymbol to DefinedRegular.

Previously SharedSymbol had Verdef member, patch changes logic. Currently SharedFile contains mapping from symbol to verdef.
That allows keep version information in a single place. Alternative solution I tried was to have Verdef in DefinedRegular as well, that was not nice IMO.
Probably we may move it to Defined class instead.

grimar reopened this revision.Mar 10 2017, 6:35 AM
This revision is now accepted and ready to land.Mar 10 2017, 6:35 AM
grimar requested review of this revision.Mar 10 2017, 6:35 AM
grimar edited edge metadata.
grimar updated this revision to Diff 91336.Mar 10 2017, 7:02 AM
  • Cosmetic changes.
ruiu added inline comments.Mar 10 2017, 11:49 AM
ELF/SymbolTable.cpp
419

This seems tricky, but I have no clear idea how to do that in a different way. If you split this patch into two, you can check this in sooner. In this patch, you are doing two things -- one is to make .bss and .bss.rel.ro synthetic sections, and the other is to change the way how we represent copied shared symbols. Probably you want to focus on the former first. That should also reduce the risk of buildbot breakage.

grimar added inline comments.Mar 13 2017, 7:28 AM
ELF/SymbolTable.cpp
419

Done: D30892

grimar abandoned this revision.Mar 15 2017, 2:32 AM

D30892 will be landed instead.