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

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

Remove comment

386

Ditto

ELF/OutputSections.h
113–114

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

ELF/Target.cpp
219–226

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

LazyRelocations = true;
PltEntrySize = 16;
PltZeroEntrySize = 16;
230–231

Always assume it's true.

238–240

Same

254

Ditto.

620

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

704

Ditto.

ELF/Writer.cpp
105

Global variables are initialized to nullptr, so

if (Target->supportsLazyRelocations())
  Out<ELFT>::GotPlt = &GotPlt;
118

Ditto.

195

Move the assignment out of this if.

200

Ditto.

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

Review comments addressed.

ELF/OutputSections.cpp
312

Done.

386

Done.

ELF/OutputSections.h
113–114

Done.

ELF/Target.cpp
219–226

Done.

230–231

Done.

238–240

Done.

254

Done.

620

Removed.

704

Removed.

ELF/Writer.cpp
105

Done.

118

Done.

195

Done.

200

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

Now I think you can remove this line.

ELF/Target.cpp
704

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.