This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] SHF_LINK_ORDER should sort based on InputSectionDescriptions
ClosedPublic

Authored by peter.smith on Jun 1 2017, 5:06 AM.

Details

Summary

This change alters the sorting for OutputSections with the SHF_LINK_ORDER flag in OutputSection::finalize() to use the InputSectionDescription representation and not the OutputSection::Sections representation.

With this change the OutputSections::Sections is no longer operated on for SHF_LINK_ORDER. The synchronize function has been changed to skip sections with SHF_LINK_ORDER as this will undo the ordering done in finalize().

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Jun 1 2017, 5:06 AM

On trunk we now have

if (!Script->Opt.HasSections) {
  if (!Config->Relocatable)
    fixSectionAlignments();
  Script->fabricateDefaultCommands();
} else {
  Script->synchronize();
}

Would it be possible to move this block together? That would avoid the need to change synchronize as it would now be earlier too.

I've updated the diff to move the fabricatedDefaultCommands() after ThunkCreation, this permits the block to stay together. Later Today I'm intending to post a set of patches to convert Thunks to insert into InputSectionDescriptions which will hopefully permit synchronize() to be removed.

This revision was automatically updated to reflect the committed changes.