This is the mail archive of the
mailing list for the GCC project.
Re: Group static constructors and destructors in specific subsections
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Cary Coutant <ccoutant at google dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, iains at gcc dot gnu dot org, tglek at mozilla dot com
- Date: Wed, 17 Jul 2013 03:31:30 +0200
- Subject: Re: Group static constructors and destructors in specific subsections
- References: <20101014203817 dot GB15487 at kam dot mff dot cuni dot cz> <AANLkTikm11+0tAMb=58MXWP8_DHLNXfBgGnZZ2o2QCw6 at mail dot gmail dot com> <CAHACq4oP_zqSE2dNNfXdui-YLoXPsQNE+BtA+cf_BQgese3AQg at mail dot gmail dot com> <20130715180530 dot GA1985 at kam dot mff dot cuni dot cz> <CAKOQZ8w96UeFYv9dyREhwz2XGcDDkq6vLjVadOzHmmykAc+KHg at mail dot gmail dot com> <20130715181846 dot GB1985 at kam dot mff dot cuni dot cz> <CAKOQZ8wSTtjnwGOAU=LEWXu42_q-A4ET54b8M0WZYXwYwnu6Dg at mail dot gmail dot com>
> On Mon, Jul 15, 2013 at 11:18 AM, Jan Hubicka <email@example.com> wrote:
> >> On Mon, Jul 15, 2013 at 11:05 AM, Jan Hubicka <firstname.lastname@example.org> wrote:
> >> > The next thing is how to tell GNU LD/Gold the relative order of functions.
> >> > I.e. my_function_section.order.125 or something like that?
> >> Gold has a --section-ordering-file option that lets you specify the
> >> order in which sections should appear in the executable. Sections not
> >> listed there follow the default rules.
> > Yep, the problem is where to produce the section ordering file.
> > The scheme is as follows:
> > - with -fprofile-generate instrument every function entry point and record
> > time of first and last invocation of the functoin
> > - At compile time we take functions that are executed during the startup
> > and we want to order them in the increasing order of the first invocation
> > time measured at FDO time. So we know the relative position of given function
> > in the program, but not the complette function order.
> Perhaps I misunderstand, but you can use --section-ordering-file
> without knowing the complete function ordering. Just specify the
> functions you care about.
The thing is that when compiling given object file, you know only functions in
that object file, so you can not produce full --section-ordering-file. We
would need a tool colleting the partial orders from all objects to single file
that I think may be just done in linker.