Created attachment 678990 [details] Compiling gdb-10.1 failed with "Intel CET must be enabled on Intel CET enabled host" Portage 3.0.9 (python 3.7.9-final-0, default/linux/x86/17.0, gcc-9.3.0, glibc-2.32-r3, 4.19.97-gentoo-tus i686) ================================================================= System uname: Linux-4.19.97-gentoo-tus-i686-Vortex86DX3-with-gentoo-2.7 KiB Mem: 2006816 total, 626432 free KiB Swap: 2097148 total, 2096628 free Timestamp of repository gentoo: Sun, 20 Dec 2020 00:00:01 +0000 Head commit of repository gentoo: 2a023ebeb3c45ce0a4a4103450442cee8a686289 sh bash 5.0_p18 ld GNU ld (Gentoo 2.34 p6) 2.34.0 app-shells/bash: 5.0_p18::gentoo dev-lang/perl: 5.30.3::gentoo dev-lang/python: 2.7.18-r5::gentoo, 3.6.12-r1::gentoo, 3.7.9::gentoo, 3.8.6-r1::gentoo, 3.9.0-r1::gentoo dev-util/cmake: 3.17.4-r1::gentoo sys-apps/baselayout: 2.7::gentoo sys-apps/openrc: 0.42.1::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.34-r2::gentoo sys-devel/gcc: 9.3.0-r2::gentoo sys-devel/gcc-config: 2.3.2-r1::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.2.1-r4::gentoo sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers) sys-libs/glibc: 2.32-r3::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="@BINARY-REDISTRIBUTABLE" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=i686 -O2 -fomit-frame-pointer -pipe" CHOST="i686-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/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=i686 -O2 -fomit-frame-pointer -pipe" 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="-O2 -march=i686 -pipe" 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="-O2 -march=i686 -pipe" GENTOO_MIRRORS="ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ https://ftp.halifax.rwth-aachen.de/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ ftp://ftp.halifax.rwth-aachen.de/gentoo/ rsync://ftp.halifax.rwth-aachen.de/gentoo/ https://ftp.fau.de/gentoo http://ftp.fau.de/gentoo ftp://ftp.fau.de/gentoo rsync://ftp.fau.de/gentoo https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ rsync://ftp-stud.hs-esslingen.de/gentoo/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j2" 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 cli crypt ftp gdbm iconv libglvnd libtirpc ncurses nls nptl openmp pam pcre readline ruby samba seccomp split-usr ssl tcpd unicode usb wifi 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" 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-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python2_7 python3_8" RUBY_TARGETS="ruby25 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 steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Can you attach config.log with CET probe failure as well?
Created attachment 679341 [details] config.log for gdb-10.1
(In reply to Volker Ernst from comment #2) > Created attachment 679341 [details] > config.log for gdb-10.1 We probbaly need to look at libiberty/config.log. The one that probes for CET features.
Created attachment 679781 [details] gdb-10.1/libiberty/config.log
(In reply to Xeha from comment #4) > Created attachment 679781 [details] > gdb-10.1/libiberty/config.log Comparing execution on my machine you have the following: ``` configure:5391: i486-pc-linux-gnu-gcc -o conftest -pipe -O2 -march=k6-3 -m3dnow -mmmx -fomit-frame-pointer -ftree-vectorize -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 --param l1-cache-size=32 --param l1-cache-line-size=32 --param l2-cache-size=256 -mtune=k6 -fcf-protection=none -Wl,-O1 -Wl,--as-needed -Wl,-z,ibt,-z,shstk conftest.c >&5 configure:5391: $? = 0 configure:5391: ./conftest /var/tmp/portage/sys-devel/gdb-10.1/work/gdb-10.1/libiberty/configure: line 1624: 853 Illegal instruction ./conftest$ac_exeext configure:5391: $? = 132 configure: program exited with status 132 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define __EXTENSIONS__ 1 | #define _ALL_SOURCE 1 | #define _GNU_SOURCE 1 | #define _POSIX_PTHREAD_SEMANTICS 1 | #define _TANDEM_SOURCE 1 | #define _FILE_OFFSET_BITS 64 | /* end confdefs.h. */ | | static void | foo (void) | { | } | | static void | __attribute__ ((noinline, noclone)) | xxx (void (*f) (void)) | { | f (); | } | | static void | __attribute__ ((noinline, noclone)) | bar (void) | { | xxx (foo); | } | | int | main () | { | bar (); | return 0; | } | configure:5401: error: Intel CET must be enabled on Intel CET enabled host ``` If you compile this example manually does it produce illegal instruction for you? It looks normal and should not generate invalid instruction.
I compiled the failing test with -g for gdb: gdb ./conftest ---- Reading symbols from ./conftest... (gdb) r Starting program: /tmp/foo/conftest Program received signal SIGILL, Illegal instruction. 0x00401050 in __libc_start_main@plt () (gdb) bt full #0 0x00401050 in __libc_start_main@plt () No symbol table info available. #1 0x004010b1 in _start () at conftest.c:49 No symbol table info available. (gdb) x/i $pc => 0x401050 <__libc_start_main@plt>: endbr32
(In reply to Xeha from comment #6) > I compiled the failing test with -g for gdb: > > gdb ./conftest > ---- > Reading symbols from ./conftest... > (gdb) r > Starting program: /tmp/foo/conftest > > Program received signal SIGILL, Illegal instruction. > 0x00401050 in __libc_start_main@plt () > (gdb) bt full > #0 0x00401050 in __libc_start_main@plt () > No symbol table info available. > #1 0x004010b1 in _start () at conftest.c:49 > No symbol table info available. > (gdb) x/i $pc > => 0x401050 <__libc_start_main@plt>: endbr32 Aha, thank you! It's an effect of gdb's -Wl,-z,ibt injection in an attempt to support CET. We'll need to at least export a knod t disable CET knob and maybe tie it to sse2 CFLAGS.
Until we fixed it properly does the following workaround work for you? $ EXTRA_ECONF=--disable-cet emerge -v1 gdb
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b5c8fdad10547ad4a8740aaa7dfad92d46d9c35 commit 5b5c8fdad10547ad4a8740aaa7dfad92d46d9c35 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-01-05 08:38:03 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-01-05 08:42:25 +0000 profiles/base/package.use.mask: mask gdb[cet] cet autodetection does not work correctly on i686: sse2 does not work there and configure bails out. Reported-by: Volker Ernst Closes: https://bugs.gentoo.org/760926 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/base/package.use.mask | 1 + 1 file changed, 1 insertion(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3adc7e343f41581f05e3d52ded688bc231548658 commit 3adc7e343f41581f05e3d52ded688bc231548658 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-01-05 08:37:00 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-01-05 08:42:24 +0000 sys-devel/gdb: make CET optional (and disabled by default) Reported-by: Volker Ernst Bug: https://bugs.gentoo.org/760926 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/gdb/gdb-10.1.ebuild | 9 +++++++-- sys-devel/gdb/gdb-9999.ebuild | 7 ++++++- sys-devel/gdb/metadata.xml | 1 + 3 files changed, 14 insertions(+), 3 deletions(-)
Can you also check if patch in https://sourceware.org/PR27397 fixes binutils from git for you? You might need to run autoconf once you apply the patch.