This is an archive of the discontinued LLVM Phabricator instance.

[ELF] GotSection increment NumEntries when Target saves GlobalOffsetTable in the .got
ClosedPublic

Authored by syzaara on Mar 21 2018, 10:28 AM.

Details

Summary

When the target saves ElfSym::GlobalOffsetTable in the .got rather than .got.plt, Target->GotHeaderEntriesNum states the number of extra entries required in the .got. Rather than having to add Target->GotHeaderEntriesNum to NumEntries in every function which refers to NumEntries, this patch changes the initial value of NumEntries in the constructor. We now add Target->GotHeaderEntriesNum to NumEntries in the constructor if the target saves the GlobalOffsetTable in the .got

Diff Detail

Repository
rL LLVM

Event Timeline

syzaara created this revision.Mar 21 2018, 10:28 AM
ruiu added inline comments.Mar 22 2018, 1:12 PM
ELF/SyntheticSections.cpp
591–592 ↗(On Diff #139324)

This comment just explains what the following code does, so it's not that useful. Please explain why we are doing this instead of what.

Also, please avoid explaining things too abstractly. The target that saves the global offset table to the first entry in the .got is PPC64 only, so please directly say so.

593 ↗(On Diff #139324)

Is this possible that GlobalOffsetTable is not defined?

syzaara updated this revision to Diff 139602.Mar 23 2018, 8:56 AM
ruiu accepted this revision.Mar 23 2018, 11:16 AM

LGTM

This revision is now accepted and ready to land.Mar 23 2018, 11:16 AM
This revision was automatically updated to reflect the committed changes.