This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Extract allocateHeaders() from assignAddresses()
ClosedPublic

Authored by peter.smith on Jun 19 2017, 3:30 AM.

Details

Summary

The allocateHeaders() function is called at the end of assignAddresses(), it decides whether the ELF header and program header table can be allocated to
a PT_LOAD program header. As the function alters state, it prevents assignAddresses() from being called multiple times. This change splits out the call to allocateHeaders() from assignAddresses() this will permit assignAddresses() to be called while processing range extension thunks without trying to allocateHeaders().

This change on its own is insufficient to allow assignAddresses() to be called multiple times in all cases, I'll send a follow up patch that resets the state accumulated during the assignAddresses().

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Jun 19 2017, 3:30 AM

This is patch 3/11 of range thunks although it can be applied independently.

jhenderson added inline comments.
ELF/LinkerScript.cpp
834 ↗(On Diff #103006)

Unnecessary return.

Thanks for the comment, I've removed the redundant return.

Rebased to account for r307039

This revision was automatically updated to reflect the committed changes.