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