From owner-freebsd-current@FreeBSD.ORG Fri Sep 18 01:15:19 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99D3B1065670 for ; Fri, 18 Sep 2009 01:15:19 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 2D0258FC1A for ; Fri, 18 Sep 2009 01:15:18 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c122-106-250-30.belrs3.nsw.optusnet.com.au [122.106.250.30]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n8I1FGhp002921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Sep 2009 11:15:17 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n8I1FFAn065282 for ; Fri, 18 Sep 2009 11:15:15 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n8I1FFgj065275 for freebsd-current@freebsd.org; Fri, 18 Sep 2009 11:15:15 +1000 (EST) (envelope-from peter) Date: Fri, 18 Sep 2009 11:15:15 +1000 From: Peter Jeremy To: freebsd-current@freebsd.org Message-ID: <20090918011515.GC1997@server.vk2pj.dyndns.org> References: <20090917061054.GA48371@server.vk2pj.dyndns.org> <20090917121642.GA1997@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0ntfKIWw70PvrIHh" Content-Disposition: inline In-Reply-To: <20090917121642.GA1997@server.vk2pj.dyndns.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: Stack protection breaks -fprofile-generate X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2009 01:15:19 -0000 --0ntfKIWw70PvrIHh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-Sep-17 22:16:42 +1000, Peter Jeremy wrote: >On 2009-Sep-17 16:10:54 +1000, Peter Jeremy wrote: >>Somewhere between early June and lastest 8.x, -fprofile-generate broke >>on i386. This looks to be related to stack protection. >> >>$ echo 'int main() { return 0; }' > x.c >>$ cc x.c >>$ cc -fprofile-generate x.c =20 >>/usr/lib/libgcov.a(_gcov.o)(.text+0x13df): In function `gcov_exit': >>/usr/src/gnu/lib/libgcov/../../../contrib/gcc/libgcov.c:532: undefined re= ference to `__stack_chk_fail_local' > >Checking on 8.0-BETA4 from yesterday (about SVN rev 197239), it fails >on i386 and succeeds on amd4. It looks suspiciously like this is >more fallout from r195697 but I'm not sure what the fix is. I had hoped r197277 might fix the problem but it doesn't: r197277 provides a weak __stack_chk_fail_local in libc.a but in my case, it's linking against libc.so. That said, libc.so _does_ have a definition of __stack_chk_fail_local so why isn't the linker finding it? builder% cc -Wl,-t -fprofile-generate x.c /usr/bin/ld: mode elf_i386_fbsd /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o /var/tmp//ccUyK2TI.o (/usr/lib/libgcov.a)_gcov_merge_add.o (/usr/lib/libgcov.a)_gcov.o -lgcc_s (/usr/lib/libgcc_s.so) -lc (/usr/lib/libc.so) -lgcc_s (/usr/lib/libgcc_s.so) /usr/lib/crtend.o /usr/lib/crtn.o /usr/lib/libgcov.a(_gcov.o)(.text+0x13df): In function `gcov_exit': /usr/src/gnu/lib/libgcov/../../../contrib/gcc/libgcov.c:532: undefined refe= rence to `__stack_chk_fail_local' /usr/bin/ld: link errors found, deleting executable `a.out' builder% nm -o -D /usr/lib/libc.so|grep __stack_chk_fail /usr/lib/libc.so:00027bbc T __stack_chk_fail /usr/lib/libc.so:00027bbc T __stack_chk_fail_local builder% nm -o /usr/lib/libgcov.a|grep __stack_chk_fail_local /usr/lib/libgcov.a:_gcov_execle.o: U __stack_chk_fail_local /usr/lib/libgcov.a:_gcov_execlp.o: U __stack_chk_fail_local /usr/lib/libgcov.a:_gcov_execl.o: U __stack_chk_fail_local /usr/lib/libgcov.a:_gcov.o: U __stack_chk_fail_local --=20 Peter Jeremy --0ntfKIWw70PvrIHh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkqy3yMACgkQ/opHv/APuIflqgCeL8srcDS1wAA2mj1JwxhjtobO m74AoLwh0mjpAKFV7vbPUOSrmayT7tm6 =Eb0K -----END PGP SIGNATURE----- --0ntfKIWw70PvrIHh--