This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: profile-driven optimization and the linker?
- From: Jeffrey A Law <law at redhat dot com>
- To: Dan Kegel <dank at kegel dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Thu, 25 Nov 2004 12:49:27 -0700
- Subject: Re: profile-driven optimization and the linker?
- Organization: Red Hat, Inc
- References: <41A620F5.5040209@kegel.com>
- Reply-to: law at redhat dot com
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