Date: Fri, 21 Jan 2011 20:27:51 +0100 From: Roman Divacky <rdivacky@freebsd.org> To: Hans Ottevanger <hansot@iae.nl> Cc: freebsd-toolchain@freebsd.org Subject: Re: How to build an executable with profiling? Message-ID: <20110121192751.GA94113@freebsd.org> In-Reply-To: <4D39B75D.6010407@iae.nl> References: <20110117184411.GA54556@troutmask.apl.washington.edu> <20110118143205.GA34216@freebsd.org> <20110118160252.GA6506@troutmask.apl.washington.edu> <20110120185449.GA92860@freebsd.org> <4D39B75D.6010407@iae.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > >This patch does three things: > > > >1) emits "call .mcount" at the begining of every function body > > >=20 > The differences on i386 between profiled and non-profiled code are not=20 > as obvious as with gcc (using diff on assembly output), but on first=20 > inspection it looks correct. =20 cool :) > >2) changes the driver to link in gcrt1.o instead of crt1.o > > > >3) changes all -lfoo to -lfoo_p except when the foo ends with _s in > > the linker invocation > > >=20 > Maybe it is wise to follow the gcc implementation here. =20 ok, makes sense > >I am not sure that I did the right thing, especially in (3). Anyway, > >the patch works for me (ie. produces a.out.gmon that seems to contain > >meaningful data). > > > >I would appreciate if you guys could test and review this. Letting me > >know if this is correct. > > >=20 > On both my systems (i386 and amd64) something goes severely wrong when=20 > linking several objects (all compiled with -pg, this is amd64): >=20 > Perhaps the invocation of the linker still needs some work (or I must=20 > redo my installation) but anyhow it looks like a good job. Thanks! I rewrote the libraries rewriting part to match gcc as close as possible. I also think that I solved your ld problem.. please revert the old patch and test the new one: http://lev.vlakno.cz/~rdivacky/clang-gprof.patch I believe this one is ok (works for me just fine), please test and report back so I can start integrating this upstream. thank you! roman --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAk053jcACgkQLVEj6D3CBEw1wwCdH++nQM1cTsxsRRFHu7So7KLp v6wAnjRpPo1JjlQxjOR1E+03Rbh6wT3P =W0vz -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110121192751.GA94113>