http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52704

             Bug #: 52704
           Summary: thunk referenced in discarded section when combining
                    -flto -ftree-vectorize -fipa-cp-clone  on Debian/SPARC
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: m...@use.net


To reproduce from scratch with 4.7.0 and sambe-3.6.3 (reduced case
below/attached):
debian-sparc:~/src/samba-3.6.3/source3# CFLAGS="-O2 -flto -mtune=leon
-floop-block -floop-interchange -floop-strip-mine -ftree-loop-distribution
-ftree-loop-distribute-patterns -ftree-loop-im -ftree-loop-ivcanon  -fivopts
-fpredictive-commoning -fipa-cp-clone -ftree-vectorize -ffast-math
-fgcse-after-reload -fgcse-sm -fgcse-las" LDFLAGS="-flto -O2" ./configure
--prefix=/opt/samba-3.6.4 --exec-prefix=/opt/samba-3.6.4
--sysconfdir=/opt/samba-3.6.4/etc --with-configdir=/opt/samba-3.6.4/etc
--with-quotas --with-pam --with-pam_smbpass --build=sparc-linux
--with-logfilebase=/opt/samba-3.6.4/var/log
--with-piddir=/opt/samba-3.6.4/var/run --with-lockdir=/opt/samba-3.6.4/var/lock

debian-sparc:~/src/samba-3.6.3/source3# make
[...]
Linking shared library bin/libtdb.so.1
gcc -I../lib/zlib -O2 -flto -mtune=leon -floop-block -floop-interchange
-floop-strip-mine -ftree-loop-distribution -ftree-loop-distribute-patterns
-ftree-loop-im -ftree-loop-ivcanon -fivopts -fpredictive-commoning
-fipa-cp-clone -ftree-vectorize -ffast-math -fgcse-after-reload -fgcse-sm
-fgcse-las -I. -I/root/src/samba-3.6.3/source3
-I/root/src/samba-3.6.3/source3/../lib/iniparser/src -Iinclude -I./include  -I.
-I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/talloc
-I../lib/tdb/include -DHAVE_CONFIG_H  -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I.
-I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt
-DLDAP_DEPRECATED  -I/root/src/samba-3.6.3/source3/lib -I.. -D_SAMBA_BUILD_=3
-D_SAMBA_BUILD_=3 -fPIC -shared -Wl,-Bsymbolic -Wl,-z,relro -flto -O2 -L./bin
-lc -Wl,-z,defs
-Wl,--version-script,/root/src/samba-3.6.3/source3/exports/`basename
bin/libtdb.so.1 | sed 's:\.so[\.0-9]*$:.syms:'` -o bin/libtdb.so.1
../lib/tdb/common/tdb.o ../lib/tdb/common/dump.o
../lib/tdb/common/transaction.o ../lib/tdb/common/error.o
../lib/tdb/common/traverse.o ../lib/tdb/common/freelist.o
../lib/tdb/common/freelistcheck.o ../lib/tdb/common/io.o
../lib/tdb/common/lock.o ../lib/tdb/common/open.o ../lib/tdb/common/check.o
../lib/tdb/common/hash.o ../lib/tdb/common/summary.o ./../lib/replace/replace.o
./../lib/replace/snprintf.o ./../lib/replace/getpass.o    \
        -Wl,-soname=`basename bin/libtdb.so.1`
`__sparc_get_pc_thunk.l7' referenced in section `.text' of
/tmp/ccUwrHhg.ltrans2.ltrans.o: defined in discarded section
`.text.__sparc_get_pc_thunk.l7.2305[__sparc_get_pc_thunk.l7.2305]' of
/tmp/ccUwrHhg.ltrans2.ltrans.o
collect2: error: ld returned 1 exit status

I reduced it to an interaction between tree-vectorize and ipa-cp-clone with
inline-functions is *not* present. when using -O3, or adding inline-functions
along with those two options, the problem goes away:
gcc -I../lib/zlib -O0 -flto -ftree-vectorize -fipa-cp-clone -I.
-I/root/src/samba-3.6.3/source3
-I/root/src/samba-3.6.3/source3/../lib/iniparser/src -Iinclude -I./include  -I.
-I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/talloc
-I../lib/tdb/include -DHAVE_CONFIG_H  -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I.
-I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt
-DLDAP_DEPRECATED  -I/root/src/samba-3.6.3/source3/lib -I.. -D_SAMBA_BUILD_=3
-D_SAMBA_BUILD_=3 -fPIC -shared -Wl,-Bsymbolic -Wl,-z,relro -flto -O2 -L./bin
-lc -Wl,-z,defs
-Wl,--version-script,/root/src/samba-3.6.3/source3/exports/`basename
bin/libtdb.so.1 | sed 's:\.so[\.0-9]*$:.syms:'` -o bin/libtdb.so.1
../lib/tdb/common/tdb.o ../lib/tdb/common/dump.o
../lib/tdb/common/transaction.o ../lib/tdb/common/error.o
../lib/tdb/common/traverse.o ../lib/tdb/common/freelist.o
../lib/tdb/common/freelistcheck.o ../lib/tdb/common/io.o
../lib/tdb/common/lock.o ../lib/tdb/common/open.o ../lib/tdb/common/check.o
../lib/tdb/common/hash.o ../lib/tdb/common/summary.o ./../lib/replace/replace.o
./../lib/replace/snprintf.o ./../lib/replace/getpass.o           
-Wl,-soname=`basename bin/libtdb.so.1`

`__sparc_get_pc_thunk.l7' referenced in section `.text' of
libtdb.so.1.ltrans2.ltrans.o: defined in discarded section
`.text.__sparc_get_pc_thunk.l7.2305[__sparc_get_pc_thunk.l7.2305]' of
libtdb.so.1.ltrans2.ltrans.o

Attached are the save-temps outputs and (hopefully) enough of the original
source dir to reproduce otherwise.

Reply via email to