This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Make sure symbol ordering is honoured
ClosedPublic

Authored by davide on Jul 24 2017, 11:18 AM.

Details

Summary

We do this emitting a section for every function when LTO is used.
See the discussion in https://bugs.llvm.org/show_bug.cgi?id=33888

I'll follow up with a similar change to the gold plugin. Other formats can probably do the same.

Diff Detail

Repository
rL LLVM

Event Timeline

davide created this revision.Jul 24 2017, 11:18 AM
ruiu edited edge metadata.Jul 24 2017, 11:39 AM

Does this make sense to make true default?

In D35809#819175, @ruiu wrote:

Does this make sense to make true default?

You mean, for the non-LTO case? Maybe, but I'd rather do it as a follow-up (as it needs more discussions/consensus).

In D35809#819175, @ruiu wrote:

Does this make sense to make true default?

You mean, for the non-LTO case? Maybe, but I'd rather do it as a follow-up (as it needs more discussions/consensus).

Sorry, let me rephrase, fat-fingering. You mean, in the LTO API? Could be, but we need agreement across all the formats using this API (i.e. also COFF and Mach-O)

ruiu added a comment.Jul 24 2017, 11:45 AM

No I mean we might want to set Conf.Options.FunctionSections to true by the ctor of lto::Config, so that that flag is true by default.

ruiu added a comment.Jul 24 2017, 11:46 AM

Ah, makes sense. I think this looks good to me but please wait for other people who actually owns this one.

pcc accepted this revision.Jul 24 2017, 12:03 PM

LGTM but I'd do the same for data-sections as well, so that we respect --gc-sections and --symbol-ordering-file for global variables.

Regarding other object formats, function-sections and data-sections have no effect on MachO because of their wacky subsections-via-symbols feature [1], so we only need to think about COFF. And I think this makes sense for COFF for the same reasons that it does for ELF. Feel free to deal with that in a followup, though.

[1] Or if we do the thing that James suggested in http://lists.llvm.org/pipermail/llvm-dev/2017-March/110763.html we would want to preserve the status quo by setting function-sections and data-sections to true when targeting MachO.

This revision is now accepted and ready to land.Jul 24 2017, 12:03 PM
This revision was automatically updated to reflect the committed changes.