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: Mon, 15 Jul 2013 20:18:46 +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>
> On Mon, Jul 15, 2013 at 11:05 AM, Jan Hubicka <email@example.com> 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.