From hjstein@bfr.co.il Fri Dec 19 15:35:35 1997
Date: 19 Nov 1997 11:55:52 +0200
From: "Harvey J. Stein"
To: Miguel A Sepulveda
Cc: axp-list@redhat.com
Subject: Re: Profiling under Linux Alpha ?
Miguel A Sepulveda writes:
> Hi Everyone,
>
> I am trying to profile and program of mine under my Alpha platform
> Kenerl 2.0.30.
>
> I compiled the sources with -g2 -pg, then run the executable. After the
> executable finishes it is suppose to generate a gmon.out, instead the
> program crash and dump a core. The program is fine because without
> the -pg option it works just fine.
I've had to do a few things with Redhat 4.2 to get profiling working.
There are two patches that have been submitted to this list which fix
problems in gcc. The first (rth-gcc-2.7.2-970921.diff.gz) fixes a
problem with large stack frames. The second
(gcc-alpha-profiling-patch-2.7.2.1-toon-971001) is said to fix some
gcc profiling problems, but I haven't proved to myself that it was
actually necessary.
In any case, here they are, along with an RPM Spec file for building
gcc. You should get gcc-2.7.2.1-2.src.rpm, unpack it, replace the
spec file in /usr/src/redhat/SPECS with the one given here, add the
patches to the SOURCES directory, and recompile gcc. Then you can
install gcc-2.7.2.1-2c.alpha.rpm. I'm appending a tarred, gzipped,
uuencoded file (gcc-new-patches.tar.gz.uue) containing the 2 patches &
the spec file.
You also need to patch gprof. The same procedure applies, but this
time to binutils-2.7.0.2-4.src.rpm. However, the binutils package
includes files which conflict with the libc headers, so your best bet
is to just replace gprof by hand after rebuilding. I'm also appending
binutils-new-patches.tar.gz.uue.
Finally, you need to patch some libraries. I believe this is actually
the most important part. The patch is in the mailing list archive:
http://www.redhat.com/support/mailing-lists/archives/axp-list/1997-March/0464.html
For convenience, I'm including the patch here (pg-fixes.tar.gz.uue),
as well as an excerpt from the above message by David Mosberger-Tang
(well, actually, most of the message) about how to apply it:
Some of you reported problems with profiling under RH4.1. Here is a
uuencoded file of three fixed object files. The md5sum output is:
0854f6609580506aeea2595d7729e27b gmon.po
e2e3cdbace223a162efe90048e0ed661 ieee_get_fp_control.po
8340b52dc581956131e038d3946ba81b ieee_set_fp_control.po
After extracting these files, replace them in your libc_p.a. E.g.:
ar rv /usr/lib/libc_p.a gmon.po ieee_{s,g}et_fp_control.po
and then profiling should work again. Note that the binutils-2.7
gprof has a bug that sometimes causes a SIGFPE. See my earlier mail
for a patch that fixes this.
Finally, there is still a problem with mixing profiling and dynamic
linking. E.g., with dynamic linking, adding -lm will cause a binary
that segfaults. Adding the -static flag should fix this problem for
now (until a real solution is found).
Good luck,
--
Harvey J. Stein
Berger Financial Research
hjstein@bfr.co.il
Patch file
|