This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: profile-driven optimization and the linker?


Jeffrey A Law wrote:
On Thu, 2004-11-25 at 10:14 -0800, Dan Kegel wrote:

http://gcc.gnu.org/news/profiledriven.html doesn't mention
having ld reorder sections to improve locality of reference
of frequently called functions.    Has that technique
been tried with gcc and binutils?

Yes. I had some success with it a while back.


With ELF it's not terribly hard since we can arrange for
each function to be put in its own section.  Thus you get
to do function-level reordering by just twiddling a linker
map.  In fact, that's where -ffunction-sections name from.

We had some hacks to gprof which would take profile data
and build a linker map.  That's the code that really needs
to be improved.  I never understood the gprof code well
enough to do it right.

Jeff


There are a couple of students doing a ECE senior design project at North Carolina Statue University using valgrind/callgrind to collect call-graph information. The information is feed into a program to generate a link script. It should do something similar to ROPE assuming that the code is compiled with -ffunction-section. There should be some information available on it in the near future, the NCSU semester is wrapping up.


-Will


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]