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.
Differential D35809
[LTO] Make sure symbol ordering is honoured davide on Jul 24 2017, 11:18 AM. Authored by
Details We do this emitting a section for every function when LTO is used. I'll follow up with a similar change to the gold plugin. Other formats can probably do the same.
Diff Detail Event TimelineComment Actions You mean, for the non-LTO case? Maybe, but I'd rather do it as a follow-up (as it needs more discussions/consensus). Comment Actions 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) Comment Actions 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. Comment Actions Ah, makes sense. I think this looks good to me but please wait for other people who actually owns this one. Comment Actions 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. |