Bug 94998 - [10 Regression] GCC 10 won't configure for host=x86, build!=host, linker=bfd due to CET
Summary: [10 Regression] GCC 10 won't configure for host=x86, build!=host, linker=bfd ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 10.1.0
: P2 normal
Target Milestone: 10.2
Assignee: H.J. Lu
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: patch
: 95811 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-08 08:40 UTC by Harald van Dijk
Modified: 2020-06-22 12:10 UTC (History)
6 users (show)

See Also:
Host: x86_64-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-05-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald van Dijk 2020-05-08 08:40:21 UTC
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.
Comment 1 Harald van Dijk 2020-05-08 08:44:06 UTC
(The bootstrap component is probably wrong if this only shows up in cross compilations.)
Comment 2 Richard Biener 2020-05-08 11:28:59 UTC
Ugh.
Comment 3 H.J. Lu 2020-05-08 13:11:52 UTC
A patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545392.html
Comment 4 Harald van Dijk 2020-05-08 17:02:36 UTC
Just confirming that that patch works for me, thanks.
Comment 5 GCC Commits 2020-05-12 17:42:34 UTC
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.
Comment 6 H.J. Lu 2020-05-12 17:50:49 UTC
Fixed on master branch so far.
Comment 7 Sergei Trofimovich 2020-06-22 08:50:28 UTC
*** Bug 95811 has been marked as a duplicate of this bug. ***
Comment 8 Richard Biener 2020-06-22 08:55:49 UTC
HJ, can you please backport?
Comment 9 GCC Commits 2020-06-22 12:09:00 UTC
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)
Comment 10 H.J. Lu 2020-06-22 12:10:39 UTC
Fixed for GCC 11 and GCC 10.2.