gcc-7.1.0 fails to build with flto profiled bootstrap build (with gold linker) + graphite optimisations

Branko brankob@s5tehnika.net
Fri Jul 14 05:16:00 GMT 2017


I have adapted existing gcc-7.1.0 ebuild and flag-o-matic eclass so that 
it allows me to build gcc with my flags without filtering them.

It works fine, when built with prefiltered flags, but I wanted to 
compile it with flto and pgo steps ( and later do same with binutils) to 
see if that would shorten long compile times.

It surely should be noteable on packages like mesa, which I have to 
compile fort 32/64-ti ABIs and where flto is a practical must - 
difference in performance is simply too great to ignore.

I'd like to speed up compiling and linking ( which can take eternity on 
bigger packages, compiled with LTO, even with gold)

So I tried to do a make priofiledboostrap with xxFLAGS and setting below:

COMMON_FLAGS="-march=native -pipe -O3 -flto=8  -ffat-lto-objects 
-flto-partition=none -fuse-linker-plugin -fuse-ld=gold 
-fno-delete-null-pointer-checks -fgraphite-identity -floop-nest-optimize"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS} -fpermissive"
LDFLAGS="-Wl,-O3 -Wl,--sort-common -Wl,-flto -Wl,--as-needed 
-ffat-lto-objects -fuse-linker-plugin -fuse-ld=gold 
-fno-delete-null-pointer-checks -fgraphite-identity -floop-nest-optimize"
LD="/usr/bin/ld.gold"

but build fails somewhere at the end of stage3 with:

  ^
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libgcc/libgcov-driver.c:885:1: 
note: ‘__gcov_exit’ was previously declared here
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libstdc++-v3/libsupc++/vterminate.cc:82: 
error: undefined reference to '_Unwind_Resume'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:2792: build/genenums] Error 1
make[3]: *** Waiting for unfinished jobs....
<built-in>: warning: type of ‘__gcov_exit’ does not match original 
declaration [-Wlto-type-mismatch]
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libgcc/libgcov-driver.c:885:1: 
note: types have different parameter counts
  __gcov_exit (void)
  ^
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libgcc/libgcov-driver.c:885:1: 
note: ‘__gcov_exit’ was previously declared here
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libstdc++-v3/libsupc++/vterminate.cc:82: 
error: undefined reference to '_Unwind_Resume'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:2792: build/genconstants] Error 1
<built-in>: warning: type of ‘__gcov_exit’ does not match original 
declaration [-Wlto-type-mismatch]
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libgcc/libgcov-driver.c:885:1: 
note: types have different parameter counts
  __gcov_exit (void)
  ^
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libgcc/libgcov-driver.c:885:1: 
note: ‘__gcov_exit’ was previously declared here
/var/tmp/portage/sys-devel/gcc-7.1.0-r4/work/gcc-7.1.0/libstdc++-v3/libsupc++/vterminate.cc:82: 
error: undefined reference to '_Unwind_Resume'
collect2: error: ld returned 1 exit status



Has anyone tried to compile gcc-7 with such combination ?

I used gcc-7.1.0 for compilation, along with binutils-2.28












More information about the Gcc-help mailing list