I attempted to build sys-devel/gcc-5.4.0-r4 using sys-devel/gcc-6.4.0-r1, and got the following error: libtool: link: /usr/x86_64-pc-linux-gnu/bin/ar rc .libs/libstdc++.a compatibility.o compatibility-debug_list.o ... /usr/x86_64-pc-linux-gnu/bin/ar: /x/portage/sys-devel/gcc-5.4.0-r4/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/lib/llvm/5/lib64/../lib64/libLLVMSupport.so.5) I think something like this might be happening: 1. ar loads the libLLVMSupport.so.5 plugin. 2. libLLVMSupport.so.5 loads libstdc++.so.6 from the build directory for some unknown reason. 4. libstdc++.so.6 is missing symbols that libLLVMSupport.so.5 requires. To reproduce the issue: 1. Select gcc-6.4.0 as the system compiler. 2. Install sys-devel/llvmgold. 3. Attempt to build gcc-5.4.0.
I also hit this bug with gcc-7.3.0 as system compiler and attempting to build gcc-6.4.0.
*** Bug 669044 has been marked as a duplicate of this bug. ***
Yeah, we'll need a way to ignore foreign injected bfd-plugins to make gcc survive the bootstrap.
*** This bug has been marked as a duplicate of bug 644772 ***