Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 260802 - valgrind-3.4.0 failure w/ gcc-4.4 -O3 (m_libcassert.c:140: Error: symbol `m_libcassert_get_ip' is already defined)
Summary: valgrind-3.4.0 failure w/ gcc-4.4 -O3 (m_libcassert.c:140: Error: symbol `m_l...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Maurice van der Pot (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-4.4
  Show dependency tree
 
Reported: 2009-03-01 23:08 UTC by Ryan Hill (RETIRED)
Modified: 2009-08-08 18:23 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
m_libcasse.tmp.halo.25754.s (m_libcasse.tmp.halo.25754.s,13.48 KB, text/plain)
2009-03-03 21:43 UTC, Ryan Hill (RETIRED)
Details
m_libcasse.tmp.halo.26391.fno-ipa-cp-clone.s (m_libcasse.tmp.halo.26391.fno-ipa-cp-clone.s,11.97 KB, text/plain)
2009-03-03 22:08 UTC, Ryan Hill (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill (RETIRED) gentoo-dev 2009-03-01 23:08:11 UTC
same error as bug #129776, resurfaces w/ GCC 4.4.

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/usr/lib64/valgrind"\"   -m32 -fno-stack-protector -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -O3 -march=core2 -pipe -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-m_libcassert.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-m_libcassert.Tpo -c -o libcoregrind_x86_linux_a-m_libcassert.o `test -f 'm_libcassert.c' || echo './'`m_libcassert.c                                                                                  
m_libcassert.c: Assembler messages:                                                                                                         
m_libcassert.c:140: Error: symbol `m_libcassert_get_ip' is already defined                                                                  
make[3]: *** [libcoregrind_x86_linux_a-m_libcassert.o] Error 1                                                                              
make[3]: Leaving directory `/var/tmp/portage/dev-util/valgrind-3.4.0/work/valgrind-3.4.0/coregrind'                                         
make[2]: *** [all] Error 2                                                                                                                  
make[2]: Leaving directory `/var/tmp/portage/dev-util/valgrind-3.4.0/work/valgrind-3.4.0/coregrind'                                         
make[1]: *** [all-recursive] Error 1                                                                                                        
make[1]: Leaving directory `/var/tmp/portage/dev-util/valgrind-3.4.0/work/valgrind-3.4.0'                                                   
make: *** [all] Error 2
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2009-03-01 23:11:44 UTC
worked around in gcc-porting overlay by always replacing -O3 w/ -O2.  leave this bug open until i find a proper fix.
Comment 2 Daniel J. 2009-03-03 14:09:38 UTC
The optimization flag that triggers the fail is -fipa-cp-clone, so CFLAGS of -O3 -fno-ipa-cp-clone builds successfully.
Comment 3 Daniel J. 2009-03-03 20:32:56 UTC
Confirm that the problem persists in valgrind-3.4.1.  Workaround is to put this in the ebuild:

if [ "$(gcc-version)" == "4.4" ]; then
    append-flags -fno-ipa-cp-clone
fi
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2009-03-03 21:43:44 UTC
Created attachment 183810 [details]
m_libcasse.tmp.halo.25754.s
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2009-03-03 22:08:50 UTC
Created attachment 183816 [details]
m_libcasse.tmp.halo.26391.fno-ipa-cp-clone.s
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2009-03-04 02:03:24 UTC
Begin forwarded message:

Date: Tue, 03 Mar 2009 16:51:58 -0800
From: Ian Lance Taylor <iant@google.com>
To: Ryan Hill <dirtyepic@gentoo.org>
Cc: gcc-help@gcc.gnu.org
Subject: Re: -fipa-cp-clone and valgrind


Ryan Hill <dirtyepic@gentoo.org> writes:

> I recently hit an error while building valgrind-3.4.0 with -O3 using
> trunk (-r144460):
>
> x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I../coregrind -I..
> -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux
> -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1
> -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/usr/lib64/valgrind"\"
> -m32 -fno-stack-protector -O2 -g -Wmissing-prototypes -Wall -Wshadow
> -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
> -Wno-format-zero-length -fno-strict-aliasing -O3 -march=core2 -pipe
> -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement
> -fno-stack-protector -MT libcoregrind_x86_linux_a-m_libcassert.o -MD
> -MP -MF .deps/libcoregrind_x86_linux_a-m_libcassert.Tpo -c -o
> libcoregrind_x86_linux_a-m_libcassert.o `test -f 'm_libcassert.c' ||
> echo
>
> './'`m_libcassert.c m_libcassert.c: Assembler messages:
> m_libcassert.c:140: Error: symbol `m_libcassert_get_ip' is already
> defined
> make[3]: *** [libcoregrind_x86_linux_a-m_libcassert.o] Error 1
> make[3]: Leaving directory
> `/var/tmp/portage/dev-util/valgrind-3.4.0/work/valgrind-3.4.0/coregrind'      
>
>
> The error was narrowed down to the use of -fipa-cp-clone.
>
> The code in question is:
>
>   48 #if defined(VGP_x86_linux)
>   49 #  define GET_REAL_PC_SP_AND_FP(pc, sp, fp)      \
>   50       asm("call m_libcassert_get_ip;" \
>   51           "m_libcassert_get_ip: popl %0;" \
>   52           "movl %%esp, %1;" \
>   53           "movl %%ebp, %2;" \
>   54           : "=r" (pc),\
>   55             "=r" (sp),\
>   56             "=r" (fp));
>
>
> My question is, is this expected?  Is this a gcc bug, a valgrind bug,
> or the natural result of me doing something silly like trying to
> compile valgrind w/ -O3?

I would say that this is a valgrind bug, a misuse of inline asm.  gcc
never promises that it will only emit one instance of the asm,
especially if, as here, the asm is not volatile.  Instead of using a
symbol name, the code should use a forward label, as in
    call 1f;
    1: popl %0
Or it should use some other technique to ensure a unique name.

Ian
Comment 7 Maurice van der Pot (RETIRED) gentoo-dev 2009-03-05 18:45:40 UTC
I've sent a mail to the valgrind-developers mailing list. Let's see if they are willing to fix issues like these or if I should maintain patches for them.
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2009-07-13 05:19:32 UTC
Maurice, I saw the initial replies to your mail on the valgrind list.  Was there ever any followup?
Comment 9 Daniel J. 2009-07-27 19:10:48 UTC
Needless to say, the problem persists in valgrind-3.4.1-r1.
Comment 10 Maurice van der Pot (RETIRED) gentoo-dev 2009-08-08 18:23:17 UTC
I checked in the fix. -r1 should work now.