Configuring libiberty fails when gcc is configured as ../gcc-10.1.0/configure --build=x86_64-forcecross-linux-gnu --host=x86_64-pc-linux-gnu --enable-languages=c,c++ CC='gcc-10.1.0 -fuse-ld=bfd' CXX='g++-10.1.0 -fuse-ld=bfd' (This is a shorter simplified configure line to make it easier to reproduce the problem, not the one I was originally using. Please ignore the fact that it's weird to trick the configure script into thinking it's cross-compiling when it's not.) It fails like so: [...] checking for CET support... configure: error: in `/h/gcc-10.1.0-build/libiberty': configure: error: cannot run test program while cross compiling See `config.log' for more details make[1]: *** [Makefile:7986: configure-libiberty] Error 1 make[1]: Leaving directory '/h/gcc-10.1.0-build' make: *** [Makefile:955: all] Error 2 It works with gold because the linker options '-Wl,-z,ibt,-z,shstk' are not accepted by gold (at least in binutils 2.34), so it never gets to the point where it tries to run the test program.
(The bootstrap component is probably wrong if this only shows up in cross compilations.)
Ugh.
A patch is posted at https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545392.html
Just confirming that that patch works for me, thanks.
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>: https://gcc.gnu.org/g:d17cdc17c90ce77cb90c569322c1f241d3530cec commit r11-333-gd17cdc17c90ce77cb90c569322c1f241d3530cec Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 12 10:39:42 2020 -0700 Enable CET in cross compiler if possible Don't perform CET run-time check for host when cross compiling. Instead, enable CET in cross compiler if possible so that it will run on both CET and non-CET hosts. config/ PR bootstrap/94998 * cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if possible. libiberty/ PR bootstrap/94998 * configure: Regenerated. lto-plugin/ PR bootstrap/94998 * configure: Regenerated.
Fixed on master branch so far.
*** Bug 95811 has been marked as a duplicate of this bug. ***
HJ, can you please backport?
The releases/gcc-10 branch has been updated by H.J. Lu <hjl@gcc.gnu.org>: https://gcc.gnu.org/g:2c7ae01349f779f1d4e66d8831052ee59f9c948b commit r10-8336-g2c7ae01349f779f1d4e66d8831052ee59f9c948b Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue May 12 10:39:42 2020 -0700 Enable CET in cross compiler if possible Don't perform CET run-time check for host when cross compiling. Instead, enable CET in cross compiler if possible so that it will run on both CET and non-CET hosts. config/ PR bootstrap/94998 * cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if possible. libiberty/ PR bootstrap/94998 * configure: Regenerated. lto-plugin/ PR bootstrap/94998 * configure: Regenerated. (cherry picked from commit d17cdc17c90ce77cb90c569322c1f241d3530cec)
Fixed for GCC 11 and GCC 10.2.