This is an archive of the discontinued LLVM Phabricator instance.

Sort orphan section if --symbol-ordering-file is given
ClosedPublic

Authored by espindola on Jan 29 2018, 4:40 PM.

Details

Summary

This changes the interaction of --symbol-ordering-file with linker scripts, but since we created --symbol-ordering-file I think this is reasonable. The new code is simpler and the behavior less surprising.

Diff Detail

Event Timeline

espindola created this revision.Jan 29 2018, 4:40 PM
espindola edited the summary of this revision. (Show Details)Jan 29 2018, 4:42 PM
grimar accepted this revision.Jan 30 2018, 1:25 AM

LGTM with nits.

ELF/LinkerScript.cpp
252

5th comment's line is outdated after the change.

ELF/Writer.cpp
1021

Its a bit inaccurate now, as sorting with --symbol-ordering-file is always applied with this change.

This revision is now accepted and ready to land.Jan 30 2018, 1:25 AM

Not sure if this is what motivated your change, but I think this will allow me to make some improvements to D42475.

Personally, I'm not convinced that we should ignore the symbol-ordering-file for non-orphaned sections, since it's more likely, I feel, for people to use linker scripts "by default" than the ordering file, but this is not really part of this change.

ELF/LinkerScript.cpp
256

Order isn't used here after this change, so it can be removed from this function plus a number of functions in the call stack, which in turn allows us to remove the buildSectionOrder call in processSectionCommands.