This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: profile-driven optimization and the linker?
Jeffrey A Law <law@redhat.com> writes:
> 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.
A year or two ago, I wrote a Python program that could compile and
link a program (with -fdata-sections), run it under a simulator,
collect memory traffic stats and re-run the linker with a custom
linker script that would rearrange global variables so that they were
allocated to faster memory regions (on systems where this was the
case).
The idea was that this could be used as a wrapper around the compiler
driver. It never got quite that refined, but the idea seemed sound.
Ben