Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 777117 - sys-devel/gcc-10.2.0-r5: configure: error: Intel CET must be enabled on Intel CET enabled host
Summary: sys-devel/gcc-10.2.0-r5: configure: error: Intel CET must be enabled on Inte...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/PR99703
Whiteboard:
Keywords:
Depends on:
Blocks: 822036
  Show dependency tree
 
Reported: 2021-03-18 21:46 UTC by Worx
Modified: 2022-10-16 03:17 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,5.20 KB, text/plain)
2021-03-18 21:56 UTC, Worx
Details
emerge pqv (emerge.pqv,285 bytes, text/plain)
2021-03-18 21:56 UTC, Worx
Details
gcc build logs (gcc-build-logs.tar.bz2,17.62 KB, application/x-bzip)
2021-03-18 21:57 UTC, Worx
Details
0002-GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch (0002-GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch,2.74 KB, patch)
2021-03-19 07:58 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
Build Logs with the patch. (gcc-build-logs.tar.v2.bz2,17.69 KB, application/x-bzip)
2021-03-19 12:45 UTC, Worx
Details
Build logs with the patch 44 in /etc/portage/patches/sys-devel/gcc-10.2.0/ (gcc-build-logs.tar.V3.bz2,17.70 KB, application/x-bzip)
2021-03-19 17:58 UTC, Worx
Details
Backport of upstream CET configure check fix to gcc 11 (0001-GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch,14.46 KB, patch)
2021-12-07 15:42 UTC, Calvin Walton
Details | Diff
GCC build log (11.2.1_p20211127 with CET configure patch added) (sys-devel:gcc-11.2.1_p20211127:20211207-034726.log.gz,97.01 KB, application/gzip)
2021-12-07 21:19 UTC, Calvin Walton
Details
emerge --info (mai-emerge-info.txt,5.00 KB, text/plain)
2021-12-07 21:25 UTC, Calvin Walton
Details
gcc build logs (updated gcc-11.2.1_p20211127 with user CET configure patch) (gcc-build-logs-2021-12-08.tar.bz2,121.43 KB, application/x-bzip)
2021-12-08 22:36 UTC, Calvin Walton
Details
Backport of upstream CET configure check fix to gcc 11 (minimal) (GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch,10.31 KB, patch)
2021-12-09 08:38 UTC, Calvin Walton
Details | Diff
Regenerate-all-configure-files-for-GCC-11.patch (Regenerate-all-configure-files-for-GCC-11.patch,19.32 KB, patch)
2021-12-09 08:43 UTC, Calvin Walton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Worx 2021-03-18 21:46:30 UTC
Hi, 

When I tried to emerge --sync on my Via C3 Samuel 2, I have this error : 

make[2]: *** [Makefile:13472: configure-stage1-lto-plugin] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
make[1]: *** [Makefile:22557: stage1-bubble] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
make: *** [Makefile:22889: bootstrap-lean] Error 2
 * ERROR: sys-devel/gcc-10.2.0-r5::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-10.2.0-r5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-10.2.0-r5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
 * S: '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0'
 *
 * Please include /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-build-logs.tar.bz2 in your bug report.

I had the same issue with Binutils : https://bugs.gentoo.org/771765



Reproducible: Always

Steps to Reproduce:
1.emerge --ask --verbose --newuse --update --deep @world

Actual Results:  
make[2]: *** [Makefile:13472: configure-stage1-lto-plugin] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
make[1]: *** [Makefile:22557: stage1-bubble] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
make: *** [Makefile:22889: bootstrap-lean] Error 2
 * ERROR: sys-devel/gcc-10.2.0-r5::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-10.2.0-r5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-10.2.0-r5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/build'
 * S: '/var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-10.2.0'
 *
 * Please include /var/tmp/portage/sys-devel/gcc-10.2.0-r5/work/gcc-build-logs.tar.bz2 in your bug report.


I had the same issue with Binutils : https://bugs.gentoo.org/771765
Comment 1 Worx 2021-03-18 21:56:34 UTC
Created attachment 692322 [details]
emerge --info
Comment 2 Worx 2021-03-18 21:56:48 UTC
Created attachment 692325 [details]
emerge pqv
Comment 3 Worx 2021-03-18 21:57:05 UTC
Created attachment 692328 [details]
gcc build logs
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-19 07:33:05 UTC
Yeah, cet.m4 will need to be synced ti gcc's upstream as well.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-19 07:51:45 UTC
Patch proposed upstream as http://gcc.1065356.n8.nabble.com/PATCH-GCC-CET-HOST-FLAGS-Check-if-host-supports-multi-byte-NOPs-td1836828.html
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-19 07:58:31 UTC
Created attachment 692367 [details, diff]
0002-GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch

Can you give 0002-GCC_CET_HOST_FLAGS-Check-if-host-supports-multi-byte.patch a try?
Comment 7 Larry the Git Cow gentoo-dev 2021-03-19 08:02:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5600e4343f36e2a4925b09388d3ffe7400143b9f

commit 5600e4343f36e2a4925b09388d3ffe7400143b9f
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-03-19 08:01:22 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-03-19 08:01:22 +0000

    10.2.0: port binutils fix for CET detection on i486
    
    Reported-by: Worx
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/44_all_cet-i486.patch | 109 ++++++++++++++++++++++++++++++++++++
 10.2.0/gentoo/README.history        |   1 +
 2 files changed, 110 insertions(+)
Comment 8 Worx 2021-03-19 12:25:19 UTC
I applied the patch, but still the same error
Comment 9 Worx 2021-03-19 12:45:15 UTC
Created attachment 692421 [details]
Build Logs with the patch.
Comment 10 Worx 2021-03-19 16:49:27 UTC
I applied manually the patch after ebuild configure, and before ebuild compile. Let me know, If i have done something bad.
Comment 11 tt_1 2021-03-19 17:09:49 UTC
I think its common practice to drop a patch into /etc/portage/patches/sys-devel/gcc-10.2.0/ ; could be worth a try for you?
Comment 12 Worx 2021-03-19 17:56:05 UTC
Ok, same issue with the previous approach. And i see the patch application in the logs.
Comment 13 Worx 2021-03-19 17:58:55 UTC
Created attachment 692460 [details]
Build logs with the patch 44 in /etc/portage/patches/sys-devel/gcc-10.2.0/
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-21 13:08:54 UTC
If you try to build gcc with EXTRA_ECONF=--disable-cet does it help?
Comment 15 Worx 2021-03-21 23:46:15 UTC
Same issue with gcc 10.2.0 compilation : 
checking for CET support... configure: error: Intel CET must be enabled on Intel CET enabled host
make[2]: *** [Makefile:14350 : configure-stage1-lto-plugin] Erreur 1
make[2] : on quitte le répertoire « /opt/gcc-10.2.0 »
make[1]: *** [Makefile:24483 : stage1-bubble] Erreur 2
make[1] : on quitte le répertoire « /opt/gcc-10.2.0 »
make: *** [Makefile:24820 : bootstrap] Erreur 2


Could you confirme my make command:  make BOOT_CFLAGS='-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer' CHOST="i586-pc-linux-gnu" CFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer" EXTRA_ECONF=--disable-cet bootstrap


Cmdline : 
c3eden# wget https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz
c3eden# tar xvzf gcc-10.2.0.tar.gz
c3eden# cd gcc-10.2.0
c3eden# ./configure
c3eden# make BOOT_CFLAGS='-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer' CHOST="i586-pc-linux-gnu" CFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer" EXTRA_ECONF=--disable-cet bootstrap
Comment 16 Worx 2021-03-21 23:58:09 UTC
Portage 3.0.13 (python 3.8.8-final-0, default/linux/x86/17.0, gcc-9.3.0, glibc-2.32-r7, 5.4.97-gentoo-x86 i686)
=================================================================
System uname: Linux-5.4.97-gentoo-x86-i686-VIA_Samuel_2-with-glibc2.1.3
KiB Mem:      890504 total,     37404 free
KiB Swap:    2097148 total,   2096884 free
Timestamp of repository gentoo: Thu, 18 Mar 2021 08:30:01 +0000
Head commit of repository gentoo: b65ee261731f99a2601ac71395d0fe4068b64a70
sh bash 5.0_p18
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.8.8::gentoo, 3.9.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.35.1-r1::gentoo
sys-devel/gcc:            9.3.0-r2::gentoo
sys-devel/gcc-config:     2.3.3::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts:
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i586-pc-linux-gnu"
CFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
CHOST="i586-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
GENTOO_MIRRORS="http://gentoo.mirrors.ovh.net/gentoo-distfiles/"
LANG="fr_FR.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl berkdb bzip2 cet cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl tcpd unicode x86 xattr zlib" ABI_X86="32" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow mmx" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 17 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-22 10:52:48 UTC
It should be a ./configure-time option:
    $ EXTRA_ECONF=--disable-cet bootstrap emerge -v1 gcc
Comment 18 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-22 10:53:11 UTC
(In reply to Sergei Trofimovich from comment #17)
> It should be a ./configure-time option:
>     $ EXTRA_ECONF=--disable-cet bootstrap emerge -v1 gcc

Sorry, trying again:
    $ EXTRA_ECONF=--disable-cet emerge -v1 gcc
Comment 19 Worx 2021-03-22 12:46:26 UTC
(In reply to Sergei Trofimovich from comment #18)
> (In reply to Sergei Trofimovich from comment #17)
> > It should be a ./configure-time option:
> >     $ EXTRA_ECONF=--disable-cet bootstrap emerge -v1 gcc
> 
> Sorry, trying again:
>     $ EXTRA_ECONF=--disable-cet emerge -v1 gcc

Thanks.

Same issue ...
Comment 20 Worx 2021-03-22 17:35:08 UTC
I created a GCC bug : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99703
Comment 21 Sergei Trofimovich (RETIRED) gentoo-dev 2021-03-22 18:27:16 UTC
Thank you! Yeah, it will help understanding why gcc is different from binutils (I still got no time to look at it in more detail, sorry).
Comment 22 Worx 2021-03-27 21:21:23 UTC
They add a patch in my gcc case, and it fix the CET detection issue. I was able to apply it to the GCC master branch.
Comment 23 Larry the Git Cow gentoo-dev 2021-04-08 19:36:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d

commit 50322c7c5fb8f869f45f8dd23a89f4a7c4b8ba2d
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-04-08 19:36:03 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-04-08 19:36:03 +0000

    10.2.0: revert "port binutils fix for CET detection on i486"
    
    The patch is not ready for prime time. Le't pull newer upstream
    version a bit later.
    
    This reverts commit 5600e4343f36e2a4925b09388d3ffe7400143b9f.
    
    Reported-by: Worx
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/44_all_cet-i486.patch | 109 ------------------------------------
 10.2.0/gentoo/README.history        |   1 -
 2 files changed, 110 deletions(-)
Comment 24 Worx 2021-05-03 13:45:54 UTC
Fixed in GCC 12

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99703
Comment 25 Sergei Trofimovich (RETIRED) gentoo-dev 2021-05-04 21:58:07 UTC
Let's mark it as resolved upsrtream. We'd prefer not to backport big ./configure changes to avoid future patch conflicts.
Comment 26 tt_1 2021-05-05 09:02:48 UTC
Would you accept an upstream backport from gcc-10.x or gcc-11.x branch for the patchset, given that there will be one?
Comment 27 Sergei Trofimovich (RETIRED) gentoo-dev 2021-05-05 18:33:25 UTC
I'd prefer pulling it in along with gcc release and not as a separate patch.
Comment 28 Thomas Capricelli 2021-09-12 08:57:40 UTC
That means waiting for months before being able to update gcc on via targets ? gcc 12 is still not released.
Comment 29 Thomas Capricelli 2021-09-12 16:27:59 UTC
For the record, i tried the patch on 
 https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=fd7eb4bc94cafa745eba75c64fa483a1689a5aad
(put it in /etc/portage/patches/sys-devel/gcc/fix-cet-detection-on-via.patch)

It applies cleanly, but i still got the error.

...
 [ ok ]
 * Applying fix-cet-detection-on-via.patch ...
 [ ok ]
...
checking for CET support... configure: error: Intel CET must be enabled on Intel CET enabled host
make[2]: *** [Makefile:14842: configure-stage1-lto-plugin] Error 1
make[2]: Leaving directory '/tmp/portage/sys-devel/gcc-11.2.0/work/build'
...
Comment 30 Calvin Walton 2021-12-07 15:42:31 UTC
Created attachment 757621 [details, diff]
Backport of upstream CET configure check fix to gcc 11

I've been using the attached patch (a backport of the upstream fix) for gcc 11.1.0 and 11.2.0 successfully, but although it still applies against gcc 11.2.1_p20211127 I'm getting a new build error with that version:

/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/ -B/usr/i586-pc-linux-gnu/bin/ -B/usr/i586-pc-linux-gnu/lib/ -isystem /usr/i586-pc-linux-gnu/include -isystem /usr/i586-pc-linux-gnu/sys-include   -fno-checking -g -O2 -march=pentium-mmx -mtune=k6-3 -pipe -O2  -g -O2 -march=pentium-mmx -mtune=k6-3 -pipe -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag -Wold-style-definition  -isystem ./include  -fpic -mlong-double-80 -DUSE_ELF_SYMVER  -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection  -fpic -mlong-double-80 -DUSE_ELF_SYMVER  -I. -I. -I../.././gcc -I/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc -I/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/. -I/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/../gcc -I/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/../include -I/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o crtfastmath.o -MT crtfastmath.o -MD -MP -MF crtfastmath.dep -c /var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/config/i386/crtfastmath.c
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgcc/config/i386/crtfastmath.c:40:1: error: ‘-fcf-protection’ is not compatible with this target

From what I've read, the "-fcf-protection" option is related to CET, so there must be some new changes introduced in the 11.2.1_p20211127 version which aren't accounted for in my patch.

It's not failing in configure any more, so the problem *isn't* the outdated config/cet.m4 file, must be something else…
Comment 31 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-07 15:48:01 UTC
(In reply to Calvin Walton from comment #30)
> Created attachment 757621 [details, diff] [details, diff]
> Backport of upstream CET configure check fix to gcc 11
> 
> I've been using the attached patch (a backport of the upstream fix) for gcc
> 11.1.0 and 11.2.0 successfully, but although it still applies against gcc
> 11.2.1_p20211127 I'm getting a new build error with that version:
> 

likely related to the e.g memtest bug (bug 828081). Can you include the build.log and emerge --info? I think I know the issue.
Comment 32 Calvin Walton 2021-12-07 19:09:19 UTC
Reverting the gentoo patch 26_all_enable-cet.patch gets me past the "-fcf-protection" build error that I was seeing.

That patch says it's "Only supported on amd64." - is it not supposed to be applied on 32-bit machines?
Comment 33 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-07 19:29:40 UTC
(In reply to Calvin Walton from comment #32)
> Reverting the gentoo patch 26_all_enable-cet.patch gets me past the
> "-fcf-protection" build error that I was seeing.
> 
> That patch says it's "Only supported on amd64." - is it not supposed to be
> applied on 32-bit machines?

Yeah, adjusting it already. It needs to just noop some of it out for 32-bit / lacking CMOV.
Comment 34 Larry the Git Cow gentoo-dev 2021-12-07 20:06:43 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=10c0905feadc59bdd449f189df75c9093a27e038

commit 10c0905feadc59bdd449f189df75c9093a27e038
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-12-07 19:22:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-07 20:06:20 +0000

    11.3.0: update CET patch to disable on 32-bit / missing CMOV
    
    Bug: https://bugs.gentoo.org/828081
    Bug: https://bugs.gentoo.org/827880
    Bug: https://bugs.gentoo.org/827905
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 11.3.0/gentoo/26_all_enable-cet.patch | 19 ++++++++++---------
 11.3.0/gentoo/README.history          |  2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)
Comment 35 Larry the Git Cow gentoo-dev 2021-12-07 20:08:44 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06ea13f0cc404136e28f91943ee06a9187b0b939

commit 06ea13f0cc404136e28f91943ee06a9187b0b939
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-12-07 20:07:02 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-07 20:08:27 +0000

    sys-devel/gcc: fix (disable) CET for x86 / no CMOV
    
    Opting not to revbump for now as the number of people
    with USE=hardened && USE=cet on < i686 seems quite small;
    we can revisit this if necessary though.
    
    This also fixes build failures in some cases on < i686
    in the same environment aforementioned.
    
    Bug: https://bugs.gentoo.org/828081
    Bug: https://bugs.gentoo.org/827880
    Bug: https://bugs.gentoo.org/827905
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 2 +-
 sys-devel/gcc/gcc-11.2.1_p20211127.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 36 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-07 20:44:17 UTC
(In reply to Calvin Walton from comment #32)
> Reverting the gentoo patch 26_all_enable-cet.patch gets me past the
> "-fcf-protection" build error that I was seeing.
> 
> That patch says it's "Only supported on amd64." - is it not supposed to be
> applied on 32-bit machines?

I still would've been interested in seeing the log because it should've only happened with USE=cet *and* USE=hardened. If you didn't have both of those set, I may need to fix another issue.

The original bug should be fixed with 11.2.1_p20211127 anyway.

Could you give that log if possible?
Comment 37 Calvin Walton 2021-12-07 21:19:39 UTC
Created attachment 757642 [details]
GCC build log (11.2.1_p20211127 with CET configure patch added)

Here's the gcc build log with the "error: ‘-fcf-protection’ is not compatible with this target" problem.
Comment 38 Calvin Walton 2021-12-07 21:21:21 UTC
Please note that *this* issue is not fixed - the gentoo patch set doesn't include the patch to fix the configure script CET detection - see attachment 757621 [details, diff]
Comment 39 Calvin Walton 2021-12-07 21:25:03 UTC
Created attachment 757656 [details]
emerge --info
Comment 40 Calvin Walton 2021-12-08 22:36:43 UTC
Created attachment 757769 [details]
gcc build logs (updated gcc-11.2.1_p20211127 with user CET configure patch)

The updated version of the 26_all_enable-cet.patch *still* doesn't fix the build on my i586 system. Here's the new gcc build logs - it now fails with the same error in a different place in the build.

(Also, please re-open this issue, since the original configure: error: Intel CET must be enabled on Intel CET enabled host is not fixed)
Comment 41 tt_1 2021-12-08 22:39:37 UTC
have you considered to run configure with the gcc-12 live ebuild? the linked upstream bug claims to be solved in that branch.
Comment 42 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-08 23:00:57 UTC
(In reply to Calvin Walton from comment #40)
> Created attachment 757769 [details]
> gcc build logs (updated gcc-11.2.1_p20211127 with user CET configure patch)
> 
> The updated version of the 26_all_enable-cet.patch *still* doesn't fix the
> build on my i586 system. Here's the new gcc build logs - it now fails with
> the same error in a different place in the build.
> 
> (Also, please re-open this issue, since the original configure: error: Intel
> CET must be enabled on Intel CET enabled host is not fixed)

yes, because I had to revert it for a moment (which version do you mean?)
Comment 43 Calvin Walton 2021-12-09 02:33:04 UTC
The first build log I posted has this version of the "all_enable-cet" patch:
https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/26_all_enable-cet.patch?id=51a7ace358097005038a0d31350b0c6d3da34e00

The second build log that I posted has this version of the "all_enable-cet" patch: https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/26_all_enable-cet.patch?id=10c0905feadc59bdd449f189df75c9093a27e038
Comment 44 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-09 02:35:29 UTC
(In reply to Calvin Walton from comment #43)
> The first build log I posted has this version of the "all_enable-cet" patch:
> https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/
> 26_all_enable-cet.patch?id=51a7ace358097005038a0d31350b0c6d3da34e00
> 
> The second build log that I posted has this version of the "all_enable-cet"
> patch:
> https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/
> 26_all_enable-cet.patch?id=10c0905feadc59bdd449f189df75c9093a27e038

Thanks a lot -- I was pretty tired last night/this morning, so I wanted to yank to the old patch (which broke the build again for you).

I'm first going to fix the general x86/<i686 issue, then I'm going to see if we can use your backported patch from 12.
Comment 45 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-09 03:01:08 UTC
(In reply to Sam James from comment #44)
> (In reply to Calvin Walton from comment #43)
> > The first build log I posted has this version of the "all_enable-cet" patch:
> > https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/
> > 26_all_enable-cet.patch?id=51a7ace358097005038a0d31350b0c6d3da34e00
> > 
> > The second build log that I posted has this version of the "all_enable-cet"
> > patch:
> > https://gitweb.gentoo.org/proj/gcc-patches.git/tree/11.3.0/gentoo/
> > 26_all_enable-cet.patch?id=10c0905feadc59bdd449f189df75c9093a27e038
> 
> Thanks a lot -- I was pretty tired last night/this morning, so I wanted to
> yank to the old patch (which broke the build again for you).
> 
> I'm first going to fix the general x86/<i686 issue, then I'm going to see if
> we can use your backported patch from 12.

Would you mind trying PATCH_VER="2" in gcc-11.2.1_p20211127.ebuild and let me know if it helps?

I've tried to exclude the irrelevant configure change hunks.
Comment 46 Calvin Walton 2021-12-09 04:21:05 UTC
The configure patch you've included with PATCH_VER="2" is incomplete, it's missing the chunk for 'libiberty' at the very least. (It looks like you used Sergei's patch from March, which several people have reported as not working)

The patch that I made in attachment 757621 [details, diff] is tested and working. I generated it by applying the upstream fixes from gcc 12, then regenerating only the 'configure' scripts for subprojects that were affected by the cet changes, so it's already nearly minimal.

(There are some *apparently* irrelevant changes, but that's actually because they'd neglected to regenerate the configure scripts before releasing gcc 11. Be careful if you attempt to manually edit the patch to remove the extra changes; there's some nested if statements that are easy to get wrong. I'd suggest just taking the entire patch as-is rather than editing it.)
Comment 47 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-09 04:30:33 UTC
(In reply to Calvin Walton from comment #46)
> The configure patch you've included with PATCH_VER="2" is incomplete, it's
> missing the chunk for 'libiberty' at the very least. (It looks like you used
> Sergei's patch from March, which several people have reported as not working)
>

I obviously didn't intend to pick one that didn't work :)

That said, it's not slyfox's, nor is it the one which got added before. It has more hunks, but indeed misses libiberty.

> The patch that I made in attachment 757621 [details, diff] [details, diff] is tested and
> working. I generated it by applying the upstream fixes from gcc 12, then
> regenerating only the 'configure' scripts for subprojects that were affected
> by the cet changes, so it's already nearly minimal.
> 
> (There are some *apparently* irrelevant changes, but that's actually because
> they'd neglected to regenerate the configure scripts before releasing gcc
> 11. Be careful if you attempt to manually edit the patch to remove the extra
> changes; there's some nested if statements that are easy to get wrong. I'd
> suggest just taking the entire patch as-is rather than editing it.)

Well, to be fair, they _are_ irrelevant (they're to do with macOS libtool changes), hence why I was trying to exclude them. But yeah, I'm inclined to just take it as-is then.

The reason I wanted to avoid that is because it complicates matters for Prefix where patches are applied for exactly that issue.
Comment 48 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-09 04:39:32 UTC
(In reply to Sam James from comment #47)
> 
> The reason I wanted to avoid that is because it complicates matters for
> Prefix where patches are applied for exactly that issue.

anyway, it is what it is, it lets us drop some of the Prefix patches which is always a good thing. Please try the newer verison of the PATCH_VER=2 tarball.
Comment 49 Calvin Walton 2021-12-09 04:45:07 UTC
Hmm. It might be possible to make a more minimal patch for this issue by rebuilding the gcc 11 configure scripts (A), applying the cet.m4 changes (I've included references to the two commits needed in my patch header), rebuilding the configure scripts again (B), and then using the diff between (A) and (B).

I can look into that, but it'll probably be a day or two to get around to it. If you can beat me to it, all the better :)

Note that my patch might be missing some of the MacOS-related changes, because (IIRC) I only included configure scripts that were affected by the cet changes. Some of the configure scripts that only had libtool-related changes might not be included.
Comment 50 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-09 05:13:47 UTC
(In reply to Calvin Walton from comment #49)
> Hmm. It might be possible to make a more minimal patch for this issue by
> rebuilding the gcc 11 configure scripts (A), applying the cet.m4 changes
> (I've included references to the two commits needed in my patch header),
> rebuilding the configure scripts again (B), and then using the diff between
> (A) and (B).
> 

Either that or try revert the macOS changes to get a cleaner diff maybe.

> I can look into that, but it'll probably be a day or two to get around to
> it. If you can beat me to it, all the better :)

I suspect I'm going to have to spend a fair bit more time making sure the default-CET stuff is okay to avoid any more issues, so if you do end up being able, it's very much appreciated.

Thanks a lot for your efforts here.
Comment 51 Calvin Walton 2021-12-09 08:38:34 UTC
Created attachment 757789 [details, diff]
Backport of upstream CET configure check fix to gcc 11 (minimal)

I found some time (and used a computer that's not 20 years old...) to create a minimal CET configure patch as I had previously described.

In my testing the behaviour in regards to the CET fix is the same as my previous patch, just in a more compact & easier to digest form.
Comment 52 Calvin Walton 2021-12-09 08:43:10 UTC
Created attachment 757790 [details, diff]
Regenerate-all-configure-files-for-GCC-11.patch

As a side-effect of the method I used to generate the CET configure patch, I also made this patch, which comprehensively regenerates all of the configure files in gcc 11. It's not directly applicable to this issue, but I suppose you might find it useful in some way?

This updates a bunch of configure files which changes that had been committed to the gcc 11 branch, but for which the configure file regeneration had been missed.

This patch is *completely independent* from the CET configure patch; you can apply either one or both of them, in any order.
Comment 53 Larry the Git Cow gentoo-dev 2021-12-18 22:00:34 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=95b03a54532e0a0a925e6d93deb7a66ea8c6f4be

commit 95b03a54532e0a0a925e6d93deb7a66ea8c6f4be
Author:     Calvin Walton <calvin.walton@kepstin.ca>
AuthorDate: 2021-12-16 08:28:50 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-18 22:00:28 +0000

    11.3.0: refine backported PR99703 fix (allow disabling CET on i486)
    
    Minimise configure patch to ease future patching.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27397
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 ...=> 75_all_x86_PR99703_12_no-cet-for-i486.patch} | 168 +++------------------
 11.3.0/gentoo/README.history                       |   2 +-
 2 files changed, 25 insertions(+), 145 deletions(-)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f233b7cc729cc0c29da815c8e102f889c1ffe8ea

commit f233b7cc729cc0c29da815c8e102f889c1ffe8ea
Author:     Calvin Walton <calvin.walton@kepstin.ca>
AuthorDate: 2021-12-09 02:58:04 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-18 22:00:28 +0000

    11.3.0: backport PR99703 fix (allow disabling CET on i486)
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27397
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 .../75_all_x86_PR99703_12_no-cet-for-i586.patch    | 509 +++++++++++++++++++++
 11.3.0/gentoo/README.history                       |   3 +-
 2 files changed, 511 insertions(+), 1 deletion(-)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=34cc4c2a7c835b5787ab1cd5d22ed72e3be2132b

commit 34cc4c2a7c835b5787ab1cd5d22ed72e3be2132b
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-12-09 02:40:05 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-18 22:00:28 +0000

    11.3.0: update CET patch to disable on 32-bit / missing CMOV, deux
    
    Bug: https://bugs.gentoo.org/828546
    Bug: https://bugs.gentoo.org/828549
    Bug: https://bugs.gentoo.org/828081
    Bug: https://bugs.gentoo.org/827880
    Bug: https://bugs.gentoo.org/827905
    Bug: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 11.3.0/gentoo/26_all_enable-cet.patch | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
Comment 54 Larry the Git Cow gentoo-dev 2021-12-18 22:03:34 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58c2f6c4fb228ddc7b17698673fbf80400a452e9

commit 58c2f6c4fb228ddc7b17698673fbf80400a452e9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-12-18 22:01:34 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-12-18 22:03:06 +0000

    sys-devel/gcc: switch patchset version for 11.2.1_p20211127 for CET fixes
    
    If hitting related issues before this, please try emerge -v1 sys-devel/gcc.
    
    Doesn't seem to have affected many people at all (just tinderbox?) so
    not worth a revbump (at this point, anyway).
    
    Also includes fix for i486 CET (unrelated).
    
    Closes: https://bugs.gentoo.org/828546
    Closes: https://bugs.gentoo.org/828549
    Closes: https://bugs.gentoo.org/828081
    Closes: https://bugs.gentoo.org/827880
    Closes: https://bugs.gentoo.org/827905
    Closes: https://bugs.gentoo.org/777117
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 2 +-
 sys-devel/gcc/gcc-11.2.1_p20211127.ebuild | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)