This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] - Lazy relocation support for x86_64.
ClosedPublic

Authored by grimar on Oct 19 2015, 1:54 AM.

Details

Summary

So thats final variant of lazy relocation support.
In compare with previous attemp there are 2 major changes:

  1. This one does not break self-hosting.
  2. DSO calls are working. Everything what was needed was implemented (I believe).
  3. Target has supportsLazyRelocations() method which can switch lazy relocs on/off (currently all targets are OFF except x64 which is ON). So no any other targets are affected now, but x64 now has lazy relocs and ability to turn it off !

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 37726.Oct 19 2015, 1:54 AM
grimar retitled this revision from to [ELF2] - Lazy relocation support for x86_64..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
ruiu added inline comments.Oct 19 2015, 12:13 PM
ELF/OutputSections.cpp
312 ↗(On Diff #37726)

Remove comment

386 ↗(On Diff #37726)

Ditto

ELF/OutputSections.h
113–114 ↗(On Diff #37726)

Use ELFFile<ELFT>::uintX_t instead of Base.

ELF/Target.cpp
219–226 ↗(On Diff #37726)

Setting true and immediately use that value in if looks very odd.

LazyRelocations = true;
PltEntrySize = 16;
PltZeroEntrySize = 16;
230–231 ↗(On Diff #37726)

Always assume it's true.

238–240 ↗(On Diff #37726)

Same

254 ↗(On Diff #37726)

Ditto.

620 ↗(On Diff #37726)

Please do not add this kind of TODO. We should rather remove all useless "= FIXME", but that should be done in other patch.

704 ↗(On Diff #37726)

Ditto.

ELF/Writer.cpp
105 ↗(On Diff #37726)

Global variables are initialized to nullptr, so

if (Target->supportsLazyRelocations())
  Out<ELFT>::GotPlt = &GotPlt;
118 ↗(On Diff #37726)

Ditto.

195 ↗(On Diff #37726)

Move the assignment out of this if.

200 ↗(On Diff #37726)

Ditto.

grimar updated this revision to Diff 37784.Oct 19 2015, 12:34 PM

Review comments addressed.

ELF/OutputSections.cpp
312 ↗(On Diff #37726)

Done.

386 ↗(On Diff #37726)

Done.

ELF/OutputSections.h
113–114 ↗(On Diff #37726)

Done.

ELF/Target.cpp
219–226 ↗(On Diff #37726)

Done.

230–231 ↗(On Diff #37726)

Done.

238–240 ↗(On Diff #37726)

Done.

254 ↗(On Diff #37726)

Done.

620 ↗(On Diff #37726)

Removed.

704 ↗(On Diff #37726)

Removed.

ELF/Writer.cpp
105 ↗(On Diff #37726)

Done.

118 ↗(On Diff #37726)

Done.

195 ↗(On Diff #37726)

Done.

200 ↗(On Diff #37726)

Done.

ruiu accepted this revision.Oct 19 2015, 1:00 PM
ruiu edited edge metadata.

LGTM with a nit. Let's give it a shot. Please verify that you can still self-host with this patch on x86-64 before submitting.

ELF/OutputSections.h
113 ↗(On Diff #37784)

Now I think you can remove this line.

ELF/Target.cpp
680 ↗(On Diff #37784)

Did you?

This revision is now accepted and ready to land.Oct 19 2015, 1:00 PM

I`ll commit tomorrow. There are some amount of conflicts after svn update.

This revision was automatically updated to reflect the committed changes.

r250807 + this patch did not break self-hosting for me.