Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2009 19:57:13 +1000 (EST)
From:      Peter Jeremy <peterjeremy@acm.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/139052: Stack protection breaks -fprofile-generate on i386
Message-ID:  <200909220957.n8M9vDVj001448@server.vk2pj.dyndns.org>
Resent-Message-ID: <200909221000.n8MA0Asx057121@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         139052
>Category:       bin
>Synopsis:       Stack protection breaks -fprofile-generate on i386
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 22 10:00:10 UTC 2009
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909220957.n8M9vDVj001448>