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
[-- Attachment #1 --]
> >This patch does three things:
> >
> >1) emits "call .mcount" at the begining of every function body
> >
>
> The differences on i386 between profiled and non-profiled code are not
> as obvious as with gcc (using diff on assembly output), but on first
> inspection it looks correct.
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
> >
>
> Maybe it is wise to follow the gcc implementation here.
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.
> >
>
> On both my systems (i386 and amd64) something goes severely wrong when
> linking several objects (all compiled with -pg, this is amd64):
>
> Perhaps the invocation of the linker still needs some work (or I must
> 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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)
iEYEARECAAYFAk053jcACgkQLVEj6D3CBEw1wwCdH++nQM1cTsxsRRFHu7So7KLp
v6wAnjRpPo1JjlQxjOR1E+03Rbh6wT3P
=W0vz
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110121192751.GA94113>
