Bug 11322 - [3.3/3.4 Regression] SH profiler outputs multiple definitions of symbol
Summary: [3.3/3.4 Regression] SH profiler outputs multiple definitions of symbol
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.3
Assignee: Andrew Pinski
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2003-06-25 23:05 UTC by marcus
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target: shl-unknown-netbsdelf1.6T
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-11-25 08:40:16


Attachments
Patch to fix this (354 bytes, patch)
2003-12-05 04:35 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description marcus 2003-06-25 23:05:30 UTC
When I compile anything with profiling enabled, the assembler
complains that a symbol is doubly defined:

doreimon:~% cat foo.c
void foo() { }
doreimon:~% gcc -c -pg foo.c
/var/tmp//ccqt8nci.s: Assembler messages:
/var/tmp//ccqt8nci.s:19: Error: symbol `.LP3' is already defined
doreimon:~% 

Looking at the generated assembler code, this is indeed the case:

        .file   "foo.c"
        .text
        .little
        .text
        .align 1
        .global foo
        .type   foo, @function
foo:
        .data
        .align 2
.LP3:
        .long   0
        .text
        mov.l   .LP3,r1
        mova    .LP3r,r0
        jmp     @r1
        nop
        .align  2
.LP3:   .long   __mcount
.LP3r:
        mov.l   r14,@-r15
        mov     r15,r14
        mov     r14,r15
        mov.l   @r15+,r14
        rts     
        nop
        .size   foo, .-foo
        .ident  "GCC: (GNU) 3.3"
Comment 1 Dara Hazeghi 2003-07-05 20:33:59 UTC
Confirmed on gcc 3.3 branch and mainline (20030705). Configuration was unsupported in gcc 
3.2.3, so this isn't a regression.
Comment 2 Dara Hazeghi 2003-08-24 17:39:14 UTC
Jason, have you seen this problem before. Any ideas how to fix it? Thanks.
Comment 3 Andrew Pinski 2003-11-25 08:40:14 UTC
The problem is that netbsd.h forgots to set NO_PROFILE_COUNTERS to 1, I cannot test 
the patch to fix this but if someone wants to can.
Comment 4 Valeriy E. Ushakov 2003-11-30 16:37:52 UTC
This has been fixed in the NetBSD tree quite some time ago

gnu/dist/gcc/gcc/config/sh/netbsd-elf.h

revision 1.2
date: 2003/08/04 00:52:43;  author: uwe;  state: Exp;  lines: +5 -0
#define NO_PROFILE_COUNTERS as we don't need them.  Otherwise both the
code to emit profile counters and the FUNCTION_PROFILER macro in this
file emit/define the same label.  For gcc 2.95.3 it used to work
because FUNCTION_PROFILER used local numeric labels instead of using
LABELNO, so it caused no conflict.
Comment 5 Andrew Pinski 2003-11-30 21:35:22 UTC
Patch is easy then, I will commit one next week as obvious.
Comment 6 Andrew Pinski 2003-12-05 04:35:26 UTC
Created attachment 5280 [details]
Patch to fix this
Comment 7 GCC Commits 2003-12-05 04:42:25 UTC
Subject: Bug 11322

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	pinskia@gcc.gnu.org	2003-12-05 04:42:20

Modified files:
	gcc/config/sh  : netbsd-elf.h 
	gcc            : ChangeLog 

Log message:
	+       PR target/11322
	+       * config/sh/netbsd-elf.h (NO_PROFILE_COUNTERS): Define.
	+

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/netbsd-elf.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.4&r2=1.4.14.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.826&r2=1.16114.2.827

Comment 8 GCC Commits 2003-12-05 04:43:35 UTC
Subject: Bug 11322

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2003-12-05 04:43:33

Modified files:
	gcc/config/sh  : netbsd-elf.h 
	gcc            : ChangeLog 

Log message:
	+       PR target/11322
	+       * config/sh/netbsd-elf.h (NO_PROFILE_COUNTERS): Define.
	+

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/netbsd-elf.h.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1919&r2=2.1920

Comment 9 Andrew Pinski 2003-12-05 04:45:13 UTC
This is a 3.3 and 3.4 regression from 2.95.3.
Fixed for 3.3.3 and 3.4.