From owner-freebsd-toolchain@FreeBSD.ORG Fri Jan 21 19:27:54 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BA02106566B for ; Fri, 21 Jan 2011 19:27:54 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 033258FC19 for ; Fri, 21 Jan 2011 19:27:53 +0000 (UTC) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 2EACB9CB0C3; Fri, 21 Jan 2011 20:27:52 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by lev.vlakno.cz (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1R+N9wCgBtxk; Fri, 21 Jan 2011 20:27:51 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 66D6A9CB125; Fri, 21 Jan 2011 20:27:51 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.4/8.14.4/Submit) id p0LJRplK094634; Fri, 21 Jan 2011 20:27:51 +0100 (CET) (envelope-from rdivacky) Date: Fri, 21 Jan 2011 20:27:51 +0100 From: Roman Divacky To: Hans Ottevanger Message-ID: <20110121192751.GA94113@freebsd.org> 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> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <4D39B75D.6010407@iae.nl> User-Agent: Mutt/1.4.2.3i Cc: freebsd-toolchain@freebsd.org Subject: Re: How to build an executable with profiling? X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2011 19:27:54 -0000 --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--