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"
Confirmed on gcc 3.3 branch and mainline (20030705). Configuration was unsupported in gcc 3.2.3, so this isn't a regression.
Jason, have you seen this problem before. Any ideas how to fix it? Thanks.
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.
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.
Patch is easy then, I will commit one next week as obvious.
Created attachment 5280 [details] Patch to fix this
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
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
This is a 3.3 and 3.4 regression from 2.95.3. Fixed for 3.3.3 and 3.4.