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

385

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;
250–251

Always assume it's true.

254

Ditto.

258–260

Same

597

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

680

Ditto.

ELF/Writer.cpp
105

Global variables are initialized to nullptr, so

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

Ditto.

197–198

Move the assignment out of this if.

205–211

Ditto.

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

Review comments addressed.

ELF/OutputSections.cpp
312

Done.

385

Done.

ELF/OutputSections.h
113–114

Done.

ELF/Target.cpp
219–226

Done.

250–251

Done.

254

Done.

258–260

Done.

597

Removed.

680

Removed.

ELF/Writer.cpp
105

Done.

119

Done.

197–198

Done.

205–211

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
680

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.