bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/12388] icf_test.sh and icf_safe_test.sh fail


From: rguenth at gcc dot gnu.org
Subject: [Bug gold/12388] icf_test.sh and icf_safe_test.sh fail
Date: Wed, 12 Jan 2011 10:30:48 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12388

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-12 
10:30:42 UTC ---
Sure.  Just to add, a readelf on the linked binary shows both respective
functions at different addresses.

icf_test.stdout:

0000000000401748 d _DYNAMIC
0000000000401920 d _GLOBAL_OFFSET_TABLE_
0000000000400628 R _IO_stdin_used
                 w _Jv_RegisterClasses
0000000000400514 T folded_func()
00000000004004f4 T common()
00000000004004ff T kept_func()
0000000000401958 d __CTOR_END__
0000000000401950 d __CTOR_LIST__
...
(I guess the above was the interesting pieces)

shell log:

+ check icf_test.stdout folded_func kept_func
++ grep folded_func icf_test.stdout
++ awk '{print $1}'
+ func_addr_1=0000000000400514
++ grep kept_func icf_test.stdout
++ awk '{print $1}'
+ func_addr_2=00000000004004ff
+ '[' 0000000000400514 '!=' 00000000004004ff ']'
+ echo 'Identical Code Folding failed to fold' folded_func and kept_func
Identical Code Folding failed to fold folded_func and kept_func
+ exit 1

(of course not too interesting with the above fact)

This is from the plain binutils 2.21 release, configured with

../configure 'CFLAGS=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wno-error'
'CXXFLAGS=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables -g -Wno-error' --prefix=/usr
--libdir=/usr/lib64 --infodir=/usr/share/info --mandir=/usr/share/man
--with-bugurl=http://bugs.opensuse.org/ '--with-pkgversion=GNU Binutils;
devel:gcc / openSUSE_Factory' --with-separate-debug-dir=/usr/lib/debug
--with-pic --build=x86_64-suse-linux
--enable-targets=alpha-suse-linux,arm-suse-linux,hppa-suse-linux,hppa64-suse-linux,i686-suse-linux,ia64-suse-linux,m68k-suse-linux,mips-suse-linux,powerpc-suse-linux,powerpc64-suse-linux,s390-suse-linux,s390x-suse-linux,sh4-suse-linux,sparc-suse-linux,sparc64-suse-linux,x86_64-suse-linux,powerpc-macos,powerpc-macos10,spu-elf
--enable-plugins --enable-gold --enable-shared

and gold configury patched to simply skip targets it doesn't know
(bah - --enable-targets is shared with all subdir configures but
the list of supported tagets differs ... that sucks).

icf_test.cpp is compiled like

g++ -DHAVE_CONFIG_H -I. -I../../../gold/testsuite -I.. 
-I../../../gold/testsuite -I../../../gold/testsuite/..
-I../../../gold/testsuite/../../include -I../../../gold/testsuite/../../elfcpp
-I.. -DLOCALEDIR="\"/usr/share/locale\""   -W -Wall    -Werror
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -fmessage-length=0
-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -Wno-error -O0 -c -ffunction-sections -g -o
icf_test.o ../../../gold/testsuite/icf_test.cc

g++ -W -Wall    -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-fmerge-constants -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wno-error  
-o icf_test -Bgcctestdir/ -Wl,--icf=all icf_test.o

and g++ is 4.5.2 which is patched to add --build-id to the link command
(-v output):

 /usr/lib64/gcc/x86_64-suse-linux/4.5/collect2 --build-id --eh-frame-hdr -m
elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o icf_test
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crt1.o
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crti.o
/usr/lib64/gcc/x86_64-suse-linux/4.5/crtbegin.o -Lgcctestdir
-L/usr/lib64/gcc/x86_64-suse-linux/4.5
-L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64
-L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib
-L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../.. --icf=all icf_test.o -lstdc++
-lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib64/gcc/x86_64-suse-linux/4.5/crtend.o
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crtn.o

which seems to be the problem(!) - with --build-id manually removed I get

    39: 00000000004004df    21 FUNC    GLOBAL DEFAULT   13 _Z9kept_funcv
    40: 00000000004004df    21 FUNC    GLOBAL DEFAULT   13 _Z11folded_funcv

is there any reason why you do not perform ICF when generating build-ids?
I can't think of any.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]