> On Mon, Jul 15, 2013 at 11:18 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > >> On Mon, Jul 15, 2013 at 11:05 AM, Jan Hubicka <hubi...@ucw.cz> 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. Honza > > Ian