This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] Sort dynamic symbols according to the MIPS requirements.
ClosedPublic

Authored by ikudrin on Nov 3 2015, 5:34 AM.

Details

Summary

The MIPS ABI has its requirements to sort entries in the .dyn.sym section.
Symbols, which are not in the GOT, have to precede symbols added in the GOT.
These latter must have the same order as the corresponding GOT entries.

Since these sorting requirements contradict those of the GNU hash section,
they cannot be used together.

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin updated this revision to Diff 39047.Nov 3 2015, 5:34 AM
ikudrin retitled this revision from to [ELF2] Sort dynamic symbols according to the MIPS requirements..
ikudrin updated this object.
ikudrin added reviewers: ruiu, rafael, atanasyan.
ikudrin added a project: lld.
ikudrin updated this object.
ikudrin added a subscriber: llvm-commits.
ruiu added inline comments.Nov 3 2015, 10:41 AM
ELF/OutputSections.cpp
925–926 ↗(On Diff #39047)

This assert is probably too much, so remove that.

933–938 ↗(On Diff #39047)

Can you make this a separate non-member function so that we can write

std::stable_sort(Symbols.begin(), Symbols.end(), sortMipsSymbols<ELFT>);
ikudrin updated this revision to Diff 39349.Nov 5 2015, 5:38 AM
  • Remove the assert.
  • Make a separate function to sort symbols.
rafael added inline comments.Nov 5 2015, 8:56 AM
ELF/OutputSections.cpp
917 ↗(On Diff #39349)

Can you include a llink (and section number) to the ABI?

918 ↗(On Diff #39349)

Why do you need the template?

ikudrin updated this revision to Diff 39378.Nov 5 2015, 9:58 AM
  • Remove redundant template.
  • Add link to the documentation.
ikudrin updated this revision to Diff 39794.Nov 10 2015, 1:35 AM
  • Rebase on the top (because D14450 depends on this revision as well as the latest commits).
atanasyan accepted this revision.Nov 11 2015, 5:07 AM
atanasyan edited edge metadata.

LGTM

This revision is now accepted and ready to land.Nov 11 2015, 5:07 AM
ruiu accepted this revision.Nov 11 2015, 3:16 PM
ruiu edited edge metadata.

LGTM

This revision was automatically updated to reflect the committed changes.