After talking to Arsen on irc, I was told to open a bug about this. I have -flto -fuse-linker-plugin in my COMMON_FLAGS in make.conf. However, if I build gcc with: USE="custom-cflags" CFLAGS="-O3 -pipe -march=native -flto -fuse-linker-plugin" CXXFLAGS="-O3 -pipe -march=native -flto -fuse-linker-plugin" doas emerge -1av gcc gcc fails to build with: make[4]: Entering directory '/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/x86_64-pc-linux-gnu/32/libgcc' /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -O2 -g -O2 -O3 -pipe -march=native -fuse-linker-plugin -DIN_GCC -fPIC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -Wl,-O1 -Wl,--as-needed -m32 -o 32/libgcc_s.so.1.tmp -g -O2 -O3 -pipe -march=native -fuse-linker-plugin -m32 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o cpuinfo_s.o tf-signs_s.o sfp-exceptions_s.o _divhc3_s.o _mulhc3_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendhfsf2_s.o extendhfdf2_s.o extendhftf2_s.o extendhfxf2_s.o extendsfdf2_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o extendbfsf2_s.o trunctfhf2_s.o truncxfhf2_s.o truncdfhf2_s.o truncsfhf2_s.o trunctfsf2_s.o truncdfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o trunctfbf2_s.o truncxfbf2_s.o truncdfbf2_s.o truncsfbf2_s.o trunchfbf2_s.o eqhf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo " Use the shared library, but some functions are only in"; echo " the static library. */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so xgcc: error: -fuse-linker-plugin is not supported in this configuration make[4]: *** [Makefile:998: libgcc_s.so] Error 1 make[4]: Leaving directory '/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/x86_64-pc-linux-gnu/32/libgcc' make[3]: *** [Makefile:1214: multi-do] Error 1 make[2]: *** [Makefile:127: all-multi] Error 2 make[1]: *** [Makefile:12201: all-target-libgcc] Error 2 make: *** [Makefile:1022: all] Error 2 To fix this. I add CFLAGS="${CFLAGS} -fno-use-linker-pligin" CXXFLAGS="${CXXFLAGS} -fno-use-linker-pligin" to /etc/portage/env/sys-devel/gcc.
Missing build.log & emerge --info.
Created attachment 882624 [details] Gcc build log
Created attachment 882625 [details] emerge --info
this gcc-build-logs.tar is missing gcc/config.log somehow..
could you post the output of /usr/x86_64-pc-linux-gnu/bin/ld --version ? also check whether the build dir has liblto_plugin.la anywhere ( find /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826 -name liblto_plugin.la )
(In reply to Arsen Arsenović from comment #5) > could you post the output of /usr/x86_64-pc-linux-gnu/bin/ld --version ? > > also check whether the build dir has liblto_plugin.la anywhere ( find > /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826 -name > liblto_plugin.la ) $ /usr/x86_64-pc-linux-gnu/bin/ld --version GNU ld (Gentoo 2.41 p4) 2.41.0 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. $ doas find /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826 -name liblto_plugin.la /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826/liblto_plugin.la (In reply to Arsen Arsenović from comment #4) > this gcc-build-logs.tar is missing gcc/config.log somehow.. That's what portage told me to include: Please include /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-build-logs.tar.xz in your bug report.
could you try finding that config.log in the gcc subdir in the work dir (note, *not* the toplevel configure, the inner gcc/config.{log,status} instead)? the config.status would be useful too.
(In reply to Arsen Arsenović from comment #7) > could you try finding that config.log in the gcc subdir in the work dir > (note, *not* the toplevel configure, the inner gcc/config.{log,status} > instead)? the config.status would be useful too. /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work # ls */config.{log,status} build/config.log build/config.status build-jit/config.log build-jit/config.status # ls */*/config.{log,status} build-jit/c++tools/config.log build-jit/gcc/config.status build-jit/libbacktrace/config.log build-jit/libcc1/config.status build-jit/libcpp/config.log build-jit/libdecnumber/config.status build-jit/c++tools/config.status build-jit/intl/config.log build-jit/libbacktrace/config.status build-jit/libcody/config.log build-jit/libcpp/config.status build-jit/libiberty/config.log build-jit/gcc/config.log build-jit/intl/config.status build-jit/libcc1/config.log build-jit/libcody/config.status build-jit/libdecnumber/config.log build-jit/libiberty/config.status I'll also use this opportunity to ask, should USE="jit" be turned on for gcc? Does that improve performance?
Created attachment 882997 [details] build/config.log
Created attachment 882998 [details] build/config.status
as the USE=jit descriptions state, it toggles libgccjit re, the config.stuff, we need the build/gcc/config.stuff, as I mentioned (though, IMO, you should tar up all of them and post them, to avoid back and forth)
(In reply to Arsen Arsenović from comment #11) > as the USE=jit descriptions state, it toggles libgccjit > > re, the config.stuff, we need the build/gcc/config.stuff, as I mentioned > (though, IMO, you should tar up all of them and post them, to avoid back and > forth) So it does not affect performance. Seems like USE="jit" is more important here that I thought. When building without USE="jit", it build correctly.
Created attachment 882999 [details] config-logs.xz
(In reply to Arsen Arsenović from comment #11) > as the USE=jit descriptions state, it toggles libgccjit > > re, the config.stuff, we need the build/gcc/config.stuff, as I mentioned > (though, IMO, you should tar up all of them and post them, to avoid back and > forth) Ran : # tar cvf ./config-logs */{config.*,*/config.*,*/*/config.*,*/*/*/config.*,*/*/*/*/config.*,*/*/*/*/*/config.*} This should be everything
Created attachment 883028 [details, diff] remove-linker-plugin-check.patch
The patch I added as an attachment removes the check for whether or not -fuse-linker-plugin is supported or not. However, that's not where the problem comes from. After applying the patch, the build fails with: make[4]: Entering directory '/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/x86_64-pc-linux-gnu/32/libgcc' /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -O2 -g -O2 -O3 -pipe -march=native -fuse-linker-plugin -DIN_GCC -fPIC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -Wl,-O1 -Wl,--as-needed -m32 -o 32/libgcc_s.so.1.tmp -g -O2 -O3 -pipe -march=native -fuse-linker-plugin -m32 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o cpuinfo_s.o tf-signs_s.o sfp-exceptions_s.o _divhc3_s.o _mulhc3_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendhfsf2_s.o extendhfdf2_s.o extendhftf2_s.o extendhfxf2_s.o extendsfdf2_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o extendbfsf2_s.o trunctfhf2_s.o truncxfhf2_s.o truncdfhf2_s.o truncsfhf2_s.o trunctfsf2_s.o truncdfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o trunctfbf2_s.o truncxfbf2_s.o truncdfbf2_s.o truncsfbf2_s.o trunchfbf2_s.o eqhf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo " Use the shared library, but some functions are only in"; echo " the static library. */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so /usr/x86_64-pc-linux-gnu/bin/ld: -plugin-opt=/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/lto-wrapper: error loading plugin: -plugin-opt=/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/./gcc/lto-wrapper: cannot open shared object file: No such file or directory collect2: error: ld returned 1 exit status make[4]: *** [Makefile:998: libgcc_s.so] Error 1 make[4]: Leaving directory '/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/build-jit/x86_64-pc-linux-gnu/32/libgcc' make[3]: *** [Makefile:1214: multi-do] Error 1 make[2]: *** [Makefile:127: all-multi] Error 2 make[1]: *** [Makefile:12201: all-target-libgcc] Error 2 make: *** [Makefile:1022: all] Error 2
Did you use slibtool? (bug 932245)
(In reply to Sam James from comment #17) > Did you use slibtool? (bug 932245) No. Regular dev-build/libtool.