http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52717
Bug #: 52717 Summary: thunk referenced in discarded section when building samba with -flto Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: m...@use.net To reproduce from scratch with 4.7.0 and samba-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 -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 [...] `__sparc_get_pc_thunk.l7' referenced in section `.text' of smbta-util.ltrans24.ltrans.o: defined in discarded section `.text.__sparc_get_pc_thunk.l7.4585[__sparc_get_pc_thunk.l7.4585]' of smbta-util.ltrans24.ltrans.o This is different from the previous bug -- there is no ipa-cp-clone here. Attached is the output from save-temps. I have yet to have any mid-sized C project fully build with LTO using -O2 or variants, most coming down to this class of errors.