11322 – [3.3/3.4 Regression] SH profiler outputs multiple definitions of symbol (original) (raw)

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 Drea 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 Drea Pinski 2003-11-30 21:35:22 UTC

Patch is easy then, I will commit one next week as obvious.

Comment 9 Drea 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.