From peterjeremy@acm.org  Tue Sep 22 09:57:17 2009
Return-Path: <peterjeremy@acm.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6FB43106568D
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 Sep 2009 09:57:17 +0000 (UTC)
	(envelope-from peterjeremy@acm.org)
Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A34A8FC18
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 Sep 2009 09:57:16 +0000 (UTC)
Received: from server.vk2pj.dyndns.org (c122-106-250-30.belrs3.nsw.optusnet.com.au [122.106.250.30])
	by mail18.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n8M9vEJF007748
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 Sep 2009 19:57:15 +1000
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 n8M9vDJW001449;
	Tue, 22 Sep 2009 19:57:13 +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 n8M9vDVj001448;
	Tue, 22 Sep 2009 19:57:13 +1000 (EST)
	(envelope-from peter)
Message-Id: <200909220957.n8M9vDVj001448@server.vk2pj.dyndns.org>
Date: Tue, 22 Sep 2009 19:57:13 +1000 (EST)
From: Peter Jeremy <peterjeremy@acm.org>
Reply-To: Peter Jeremy <peterjeremy@acm.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Stack protection breaks -fprofile-generate on i386
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         139052
>Category:       bin
>Synopsis:       gcc(1): Stack protection breaks -fprofile-generate on i386
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 22 10:00:10 UTC 2009
>Closed-Date:    Fri Oct 19 03:51:32 UTC 2012
>Last-Modified:  Fri Oct 19 03:51:32 UTC 2012
>Originator:     Peter Jeremy
>Release:        FreeBSD 8.0-BETA4 i386
>Organization:
n/a
>Environment:
System: FreeBSD aspire.vk2pj.dyndns.org 8.0-BETA4 FreeBSD 8.0-BETA4 #10: Thu Sep 17 09:46:01 EST 2009 root@builder.vk2pj.dyndns.org:/obj/usr/src/sys/aspire i386

>Description:

Somewhere between early June and -BETA4 (about SVN rev 197239),
-fprofile-generate broke on 8.x/i386.  The problem does not exist on
amd64.  This looks to be related to stack protection.

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 the test below is linking against libc.so.

>How-To-Repeat:
$ echo 'int main() { return 0; }' > x.c
$ cc x.c
$ 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 reference to `__stack_chk_fail_local'
/usr/bin/ld: link errors found, deleting executable `a.out'
$ 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
$ 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

>Fix:
	Unknown.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kan 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 24 20:31:45 UTC 2009 
Responsible-Changed-Why:  
Over to committer of r195697 for evaluation. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139052 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/139052: commit references a PR
Date: Sun, 25 Oct 2009 15:52:40 +0000 (UTC)

 Author: kan
 Date: Sun Oct 25 15:52:31 2009
 New Revision: 198471
 URL: http://svn.freebsd.org/changeset/base/198471
 
 Log:
   Compile libgcov without stack protection. It can be linked into
   both static and dynamic binaries compiled with or without stack
   protection and should not depend on libssp_nonshared.a symbols.
   
   Discussed with: kib
   PR:		bin/139052
 
 Modified:
   head/gnu/lib/libgcov/Makefile
 
 Modified: head/gnu/lib/libgcov/Makefile
 ==============================================================================
 --- head/gnu/lib/libgcov/Makefile	Sun Oct 25 11:01:53 2009	(r198470)
 +++ head/gnu/lib/libgcov/Makefile	Sun Oct 25 15:52:31 2009	(r198471)
 @@ -2,6 +2,7 @@
  
  NO_PROFILE=
  .include <bsd.own.mk>
 +MK_SSP=		no
  .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
  
  GCCDIR=	${.CURDIR}/../../../contrib/gcc
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/139052: commit references a PR
Date: Sun, 20 Dec 2009 02:35:33 +0000 (UTC)

 Author: kan
 Date: Sun Dec 20 02:35:10 2009
 New Revision: 200748
 URL: http://svn.freebsd.org/changeset/base/200748
 
 Log:
   MFC r198471.
   
   Log:
     Compile libgcov without stack protection. It can be linked into
     both static and dynamic binaries compiled with or without stack
     protection and should not depend on libssp_nonshared.a symbols.
   
     Discussed with: kib
     PR:		bin/139052
 
 Modified:
   stable/8/gnu/lib/libgcov/Makefile
 
 Modified: stable/8/gnu/lib/libgcov/Makefile
 ==============================================================================
 --- stable/8/gnu/lib/libgcov/Makefile	Sun Dec 20 01:46:23 2009	(r200747)
 +++ stable/8/gnu/lib/libgcov/Makefile	Sun Dec 20 02:35:10 2009	(r200748)
 @@ -2,6 +2,7 @@
  
  NO_PROFILE=
  .include <bsd.own.mk>
 +MK_SSP=		no
  .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
  
  GCCDIR=	${.CURDIR}/../../../contrib/gcc
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: eadler 
State-Changed-When: Tue Mar 1 10:16:09 EST 2011 
State-Changed-Why:  
committed in head (198471) and 8 (200748) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139052 
State-Changed-From-To: patched->closed 
State-Changed-By: peterj 
State-Changed-When: Fri Oct 19 03:50:31 UTC 2012 
State-Changed-Why:  
Fix committed and MFC'd 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139052 
>Unformatted:
