If we use GCC LTO build Emacs whatever which version include 30 29.3 29.4 I tested. When I delete a whole line like Ctrl-K, Emacs will immediately crash. So I think we should disable or warning user when use GCC LTO
I can't reproduce this and I'm sure Arsen can't, as we both use GCC LTO heavily. Please first get us a backtrace for when it crashes. Please also share emerge --info app-editors/emacs.
emerge --info and build.log please.
Portage 3.0.66.1 (python 3.12.7-final-0, default/linux/amd64/23.0/desktop/plasma, gcc-14, glibc-2.40-r5, 6.11.2-cachyos-6.11.2 x86_64) ================================================================= System uname: Linux-6.11.2-cachyos-6.11.2-x86_64-AMD_Ryzen_AI_9_365_w-_Radeon_880M-with-glibc2.40 KiB Mem: 31899108 total, 5583688 free KiB Swap: 32726008 total, 29453304 free Timestamp of repository gentoo: Thu, 10 Oct 2024 02:33:32 +0000 Head commit of repository gentoo: 440773c41da740703b1a4bea49b9342ff2be8374 Timestamp of repository CachyOS-kernels: Tue, 08 Oct 2024 15:51:33 +0000 Head commit of repository CachyOS-kernels: e992e228218cadda4c633fe95b1e3f36df613074 Timestamp of repository Case_Of: Tue, 08 Oct 2024 20:33:19 +0000 Head commit of repository Case_Of: 8c76861ff47de791c1ab244a271308b0d8f37c30 Timestamp of repository beatussum-overlay: Tue, 08 Oct 2024 15:51:12 +0000 Head commit of repository beatussum-overlay: 8a3a05760132ef3b4909335f326a67cdce313572 Head commit of repository gen-fast: c008de513e4f41fdf082ae9aa07127454457f272 Timestamp of repository gentoo-zh: Wed, 09 Oct 2024 12:48:20 +0000 Head commit of repository gentoo-zh: c24800198af71fb72e9d726b50d235e01f8b67fe Timestamp of repository guru: Wed, 09 Oct 2024 22:53:06 +0000 Head commit of repository guru: bd9ad593ddc50c05ecff792b07d6059d652faa68 Timestamp of repository menelkir: Tue, 08 Oct 2024 15:51:12 +0000 Head commit of repository menelkir: cf1244d6710d6cd3a848180cf3c28d2bfcd53c62 Timestamp of repository nest: Tue, 08 Oct 2024 15:51:08 +0000 Head commit of repository nest: 26e7d5eee6bb210c95e2811a5c88bd64c08784d2 Timestamp of repository pg_overlay: Thu, 10 Oct 2024 01:33:23 +0000 Head commit of repository pg_overlay: 6349bd7936280d48db2ea5bc86bcbe9c42921e58 Timestamp of repository src_prepare-overlay: Tue, 08 Oct 2024 21:18:25 +0000 Head commit of repository src_prepare-overlay: 6cf4e69bd7a208e7b03c3760bc1a47f8afeb9989 Timestamp of repository steam-overlay: Tue, 08 Oct 2024 15:50:59 +0000 Head commit of repository steam-overlay: 1dc5a0d57c688eacd472d714a0621b6c277a9385 Timestamp of repository wayland-desktop: Tue, 08 Oct 2024 15:51:16 +0000 Head commit of repository wayland-desktop: 0bb5d1cd72ca056056585179a90517e1d11be29a Timestamp of repository zGentoo: Tue, 08 Oct 2024 15:51:21 +0000 Head commit of repository zGentoo: 87ee17f9fc67be6b8b23d9149bcf03e4ab5f3670 sh bash 5.2_p37 ld GNU ld (Gentoo 2.43 p2) 2.43.1 ccache version 4.10.2 [disabled] app-misc/pax-utils: 1.3.8::gentoo app-shells/bash: 5.2_p37::gentoo dev-build/autoconf: 2.72-r1::gentoo dev-build/automake: 1.17-r1::gentoo dev-build/cmake: 3.30.5::gentoo dev-build/libtool: 2.5.3::gentoo dev-build/make: 4.4.1-r100::gentoo dev-build/meson: 1.5.2::gentoo dev-java/java-config: 2.3.4::gentoo dev-lang/perl: 5.40.0::gentoo dev-lang/python: 3.12.7_p1::gentoo, 3.13.0::gentoo dev-lang/rust-bin: 1.81.0::gentoo dev-util/ccache: 4.10.2-r1::gentoo sys-apps/baselayout: 2.15::gentoo sys-apps/openrc: 0.55.1::gentoo sys-apps/sandbox: 2.39::gentoo sys-devel/binutils: 2.43-r1::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/clang: 18.1.8::gentoo, 19.1.1::gentoo sys-devel/gcc: 14.2.1_p20240921::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/lld: 19.1.1::gentoo sys-devel/llvm: 18.1.8-r4::gentoo, 19.1.1::gentoo sys-kernel/linux-headers: 6.10::gentoo (virtual/os-headers) sys-libs/glibc: 2.40-r5::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 volatile: False CachyOS-kernels location: /var/db/repos/CachyOS-kernels sync-type: git sync-uri: https://github.com/gentoo-mirror/CachyOS-kernels.git masters: gentoo volatile: False Case_Of location: /var/db/repos/Case_Of sync-type: git sync-uri: https://github.com/gentoo-mirror/Case_Of.git masters: gentoo volatile: False beatussum-overlay location: /var/db/repos/beatussum-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/beatussum-overlay.git masters: gentoo volatile: False gen-fast location: /var/db/repos/gen-fast sync-type: git sync-uri: https://codeberg.org/xz-dev/gen-fast.git masters: gentoo volatile: True gentoo-zh location: /var/db/repos/gentoo-zh sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git masters: gentoo volatile: False guru location: /var/db/repos/guru sync-type: git sync-uri: https://github.com/gentoo-mirror/guru.git masters: gentoo volatile: False menelkir location: /var/db/repos/menelkir sync-type: git sync-uri: https://github.com/gentoo-mirror/menelkir.git masters: gentoo volatile: False nest location: /var/db/repos/nest sync-type: git sync-uri: https://github.com/gentoo-mirror/nest.git masters: gentoo volatile: False pg_overlay location: /var/db/repos/pg_overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/pg_overlay.git masters: gentoo volatile: False src_prepare-overlay location: /var/db/repos/src_prepare-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/src_prepare-overlay.git masters: gentoo volatile: False steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo volatile: False wayland-desktop location: /var/db/repos/wayland-desktop sync-type: git sync-uri: https://github.com/gentoo-mirror/wayland-desktop.git masters: gentoo volatile: False zGentoo location: /var/db/repos/zGentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/zGentoo.git masters: gentoo volatile: False local location: /var/db/repos/local masters: gentoo priority: 100 volatile: True Binary Repositories: binhost priority: 9999 sync-uri: https://mirrors.tuna.tsinghua.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64-v3 Installed sets: @app-appman, @appimage, @apps, @apps-admin, @apps-bpf, @apps-game, @apps-network, @apps-patch, @apps-secure, @apps-terminal, @apps-vm, @container, @desktop, @dev-coljure, @dev-python, @dev-tools, @editer, @emacs, @fonts, @gentoo-package, @gentoo-tools, @hyprland, @kde, @kernel, @markdown, @media-hardware-acceleration, @nvim, @package-manager, @river, @sys, @sys-module, @sys-patch ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA Microsoft-vscode" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O3 -pipe -march=native" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O3 -pipe -march=native" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--jobs 6" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME" FCFLAGS="-O3 -pipe -march=native" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance binpkg-request-signature binpkg-signing buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles getbinpkg gpg-keepalive ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O3 -pipe -march=native" GENTOO_MIRRORS="rsync://rsync.mirrors.ustc.edu.cn/gentoo/" LANG="zh_CN.UTF-8" LC_ALL="zh_CN.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs" LEX="flex" LINGUAS="en en_US zh zh_CN" 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" SHELL="/bin/bash" USE="X a52 aac acl acpi activities alsa amd64 bash-completion bluetooth branding bzip2 cairo cdda cdr cet compress-zstd crypt cups dbus declarative dri dts dvd dvdr elogind encode exif flac gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kf6compat kwallet lcms libnotify libtirpc lto mad man mng modules-compress modules-sign mp3 mp4 mpeg multilib ncurses networkmanager nftables nls ogg opengl openmp openrc opus pam pango pcre pdf pgo pipewire plasma png policykit ppds pulseaudio qml qt5 qt6 readline screencast sdl seccomp semantic-desktop sound spell ssl startup-notification svg test-rust theora tiff truetype udev udisks unicode upower usb vaapi vdpau verify-sig vorbis vulkan wayland widgets wxwidgets x264 x265 xattr xcb xft xml xv xvid zlib zstd" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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="mmx mmxext sse sse2 aes avx avx2 avx512_bf16 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vp2intersect avx512_vpopcntdq avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3 vpclmulqdq" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-US zh-CN zh" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
❯ eix app-editors/emacs [I] app-editors/emacs Available versions: (18) 18.59-r15 (26) 26.3-r18 26.3-r19 (27) 27.2-r16^t 27.2-r17^t (28) 28.2-r12 28.2-r13 (29) 29.3-r2 29.3-r3 29.4{xpak:2} (30-vcs) [M](~)30.0.91 **30.0.9999-r1*l (31-vcs) **31.0.9999*l {+X Xaw3d acl alsa aqua athena cairo dbus dynamic-loading games gfile gif +gmp gpm gsettings gtk gui gzip-el harfbuzz imagemagick +inotify jit jpeg json kerberos lcms libxml2 livecd m17n-lib mailutils motif png selinux sound source sqlite ssl svg systemd +threads tiff toolkit-scroll-bars tree-sitter valgrind webp wide-int xattr xft +xpm zlib ABI_X86="x32"} Installed versions: 29.4(29){xpak:2}(19时09分58秒 2024年10月10日)(acl alsa cairo dbus gif gmp gpm gtk gui inotify jpeg lcms png sound ssl svg threads tiff xft xpm zlib -X -Xaw3d -aqua -athena -dynamic-loading -games -gfile -gsettings -gzip-el -harfbuzz -imagemagick -jit -json -kerberos -libxml2 -livecd -m17n-lib -mailutils -motif -selinux -source -sqlite -systemd -toolkit-scroll-bars -tree-sitter -valgrind -webp -wide-int) Homepage: https://www.gnu.org/software/emacs/ Description: The extensible, customizable, self-documenting real-time display editor backtrace: ❯ emacs -q Fatal error 11: Segmentation fault Backtrace: emacs(+0x169aef) [0x5d9d6e28eaef] emacs(+0x2148f) [0x5d9d6e14648f] emacs(+0x222bd) [0x5d9d6e1472bd] /usr/lib64/libc.so.6(+0x41c70) [0x792f9444fc70] emacs(+0x2ddec9) [0x5d9d6e402ec9] emacs(+0x145725) [0x5d9d6e26a725] emacs(+0x14bf91) [0x5d9d6e270f91] emacs(+0x265e6a) [0x5d9d6e38ae6a] emacs(+0x3b0d2) [0x5d9d6e1600d2] emacs(+0x1507e4) [0x5d9d6e2757e4] emacs(+0x2fcd85) [0x5d9d6e421d85] emacs(+0x1431c5) [0x5d9d6e2681c5] emacs(+0x204997) [0x5d9d6e329997] emacs(+0x140ede) [0x5d9d6e265ede] emacs(+0x1f96e4) [0x5d9d6e31e6e4] emacs(+0x1429d9) [0x5d9d6e2679d9] emacs(+0x322a64) [0x5d9d6e447a64] emacs(+0x142ed0) [0x5d9d6e267ed0] emacs(+0x2e442) [0x5d9d6e153442] /usr/lib64/libc.so.6(+0x265ce) [0x792f944345ce] /usr/lib64/libc.so.6(__libc_start_main+0x89) [0x792f94434689] emacs(+0x2e6b5) [0x5d9d6e1536b5] fish: Job 1, 'emacs -q' terminated by signal SIGSEGV (Address boundary error)
Created attachment 905151 [details] app-editors/emacs build log
But I'm not sure what's the useful backtrace
app-editors/emacs compiler-gcc-lto ccache file env/compiler-gcc-lto: CFLAGS="${CFLAGS} -flto=20" CXXFLAGS="${CXXFLAGS} -flto=20" FCFLAGS="${FCFLAGS} -flto=20" FFLAGS="${FFLAGS} -flto=20"
Crash case: 1. -X gtk gui (PGTK) 2. use -flto=20 If only 1 or 2, wont crash
(In reply to inkflaw from comment #8) > Crash case: > 1. -X gtk gui (PGTK) > 2. use -flto=20 > > If only 1 or 2, wont crash Based on that - if you have BOTH and run GNU Emacs with "emacs -nw -q" will it die?
Build Emacs with https://wiki.gentoo.org/wiki/Debugging then run it under gdb to get a backtrace.
(In reply to Maciej Barć from comment #9) > (In reply to inkflaw from comment #8) > > Crash case: > > 1. -X gtk gui (PGTK) > > 2. use -flto=20 > > > > If only 1 or 2, wont crash > > Based on that - if you have BOTH and run GNU Emacs with "emacs -nw -q" will > it die? In CLI mode, emacs wont crash. That's way I think PGTK with LTO is problem
I also find, if I use "-O2" not "-O3", it will working fine with LTO. And here is the backtrace ❯ gdb emacs ~ GNU gdb (Gentoo 15.2 vanilla) 15.2 Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://bugs.gentoo.org/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from emacs... (gdb) run -q Starting program: /usr/bin/emacs -q [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib64/libthread_db.so.1". [New Thread 0x7ffff10006c0 (LWP 6868)] [New Thread 0x7ffff06006c0 (LWP 6869)] [New Thread 0x7fffefc006c0 (LWP 6870)] [New Thread 0x7fffef2006c0 (LWP 6871)] [New Thread 0x7fffee8006c0 (LWP 6872)] [New Thread 0x7fffeda006c0 (LWP 6873)] Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. pgtk_handle_selection_request (event=0x7fffffffc0a0) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/pgtkselect.c:573 warning: 573 /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/pgtkselect.c: 没有那个文件或目录 (gdb) backtrace #0 pgtk_handle_selection_request (event=0x7fffffffc0a0) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/pgtkselect.c:573 #1 0x0000555555699725 in pgtk_handle_selection_event (event=0x7fffffffc0a0) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/pgtkselect.c:784 #2 process_special_events () at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:4449 #3 0x000055555569ff91 in swallow_events (do_display=true) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:4489 #4 0x00005555557b9e6a in wait_reading_process_output (time_limit=<optimized out>, nsecs=<optimized out>, read_kbd=<optimized out>, do_display=<optimized out>, wait_for_cell=<optimized out>, wait_proc=<optimized out>, just_wait_proc=<optimized out>) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/process.c:5788 #5 0x000055555558f0d2 in sit_for (timeout=<optimized out>, reading=<optimized out>, display_option=<optimized out>) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/dispnew.c:6263 #6 0x00005555556a47e4 in read_char (commandflag=1, map=0x5555562d3da3, prev_event=0x0, used_mouse_menu=0x7fffffffcceb, end_time=0x0) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/lisp.h:767 #7 0x0000555555850d85 in read_key_sequence.constprop.0 (keybuf=0x7fffffffce80, prevent_redisplay=false, fix_current_buffer=<optimized out>, can_return_switch_frame=<optimized out>, dont_downcase_last=<optimized out>, prompt=<optimized out>) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:10084 #8 0x00005555556971c5 in command_loop_1 () at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:1384 #9 0x0000555555758997 in internal_condition_case (bfun=0x555555696f00 <command_loop_1>, handlers=<optimized out>, hfun=0x555555694c00 <cmd_error>) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/eval.c:1474 #10 0x0000555555694ede in command_loop_2 (handlers=handlers@entry=0x90) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:1133 #11 0x000055555574d6e4 in internal_catch (tag=<optimized out>, func=0x555555694eb0 <command_loop_2>, arg=0x90) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/eval.c:1197 #12 0x00005555556969d9 in command_loop () at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:1111 #13 0x0000555555876a64 in recursive_edit_1.isra.0 () at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:720 #14 0x0000555555696ed0 in Frecursive_edit () at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/keyboard.c:803 #15 0x0000555555582442 in main (argc=<optimized out>, argv=0x7fffffffd418) at /var/tmp/portage/app-editors/emacs-29.4/work/emacs-29.4/src/emacs.c:2521 (gdb)
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70073 was using LTO and failed in the same function at least...
And I also find if I not use "-march=native", it also will working fine. What can I do next? > gcc -march=native -Q --help=target The following options are target specific: -m128bit-long-double [enabled] -m16 [disabled] -m32 [disabled] -m3dnow [disabled] -m3dnowa [disabled] -m64 [enabled] -m80387 [enabled] -m8bit-idiv [disabled] -m96bit-long-double [disabled] -mabi= sysv -mabm [enabled] -maccumulate-outgoing-args [disabled] -maddress-mode= long -madx [enabled] -maes [enabled] -malign-data= compat -malign-double [disabled] -malign-functions= 0 -malign-jumps= 0 -malign-loops= 0 -malign-stringops [enabled] -mamx-bf16 [disabled] -mamx-complex [disabled] -mamx-fp16 [disabled] -mamx-int8 [disabled] -mamx-tile [disabled] -mandroid [disabled] -mapx-features= none -mapx-inline-asm-use-gpr32 [disabled] -mapxf [disabled] -march= znver5 -masm= att -mavx [enabled] -mavx10.1 -mavx10.1-256 -mavx10.1-256 [disabled] -mavx10.1-512 [disabled] -mavx2 [enabled] -mavx256-split-unaligned-load [disabled] -mavx256-split-unaligned-store [disabled] -mavx5124fmaps [disabled] -mavx5124vnniw [disabled] -mavx512bf16 [enabled] -mavx512bitalg [enabled] -mavx512bw [enabled] -mavx512cd [enabled] -mavx512dq [enabled] -mavx512er [disabled] -mavx512f [enabled] -mavx512fp16 [disabled] -mavx512ifma [enabled] -mavx512pf [disabled] -mavx512vbmi [enabled] -mavx512vbmi2 [enabled] -mavx512vl [enabled] -mavx512vnni [enabled] -mavx512vp2intersect [enabled] -mavx512vpopcntdq [enabled] -mavxifma [disabled] -mavxneconvert [disabled] -mavxvnni [enabled] -mavxvnniint16 [disabled] -mavxvnniint8 [disabled] -mbionic [disabled] -mbmi [enabled] -mbmi2 [enabled] -mbranch-cost=<0,5> 3 -mcall-ms2sysv-xlogues [disabled] -mcet-switch [disabled] -mcld [disabled] -mcldemote [disabled] -mclflushopt [enabled] -mclwb [enabled] -mclzero [enabled] -mcmodel= [default] -mcmpccxadd [disabled] -mcpu= -mcrc32 [enabled] -mcx16 [enabled] -mdaz-ftz [disabled] -mdirect-extern-access [enabled] -mdispatch-scheduler [disabled] -mdump-tune-features [disabled] -menqcmd [disabled] -mevex512 [enabled] -mf16c [enabled] -mfancy-math-387 [enabled] -mfentry [disabled] -mfentry-name= -mfentry-section= -mfma [enabled] -mfma4 [disabled] -mforce-drap [disabled] -mforce-indirect-call [disabled] -mfp-ret-in-387 [enabled] -mfpmath= sse -mfsgsbase [enabled] -mfunction-return= keep -mfused-madd -ffp-contract=fast -mfxsr [enabled] -mgather -mtune-ctrl=use_gather -mgeneral-regs-only [disabled] -mgfni [enabled] -mglibc [enabled] -mhard-float [enabled] -mharden-sls= none -mhle [disabled] -mhreset [disabled] -miamcu [disabled] -mieee-fp [enabled] -mincoming-stack-boundary= 0 -mindirect-branch-cs-prefix [disabled] -mindirect-branch-register [disabled] -mindirect-branch= keep -minline-all-stringops [disabled] -minline-stringops-dynamically [disabled] -minstrument-return= none -mintel-syntax -masm=intel -mkl [disabled] -mlam= none -mlarge-data-threshold=<number> 65536 -mlong-double-128 [disabled] -mlong-double-64 [disabled] -mlong-double-80 [enabled] -mlwp [disabled] -mlzcnt [enabled] -mmanual-endbr [disabled] -mmemcpy-strategy= -mmemset-strategy= -mmitigate-rop [disabled] -mmmx [enabled] -mmovbe [enabled] -mmovdir64b [enabled] -mmovdiri [enabled] -mmove-max= 512 -mmpx [disabled] -mms-bitfields [disabled] -mmusl [disabled] -mmwait [enabled] -mmwaitx [enabled] -mneeded [disabled] -mno-align-stringops [disabled] -mno-default [disabled] -mno-fancy-math-387 [disabled] -mno-push-args [disabled] -mno-red-zone [disabled] -mno-sse4 [disabled] -mnop-mcount [disabled] -mnoreturn-no-callee-saved-registers [disabled] -momit-leaf-frame-pointer [disabled] -mpartial-vector-fp-math [enabled] -mpc32 [disabled] -mpc64 [disabled] -mpc80 [disabled] -mpclmul [enabled] -mpcommit [disabled] -mpconfig [disabled] -mpku [enabled] -mpopcnt [enabled] -mprefer-avx128 -mprefer-vector-width=128 -mprefer-vector-width= none -mpreferred-stack-boundary= 0 -mprefetchi [disabled] -mprefetchwt1 [disabled] -mprfchw [enabled] -mptwrite [disabled] -mpush-args [enabled] -mraoint [disabled] -mrdpid [enabled] -mrdrnd [enabled] -mrdseed [enabled] -mrecip [disabled] -mrecip= -mrecord-mcount [disabled] -mrecord-return [disabled] -mred-zone [enabled] -mregparm= 6 -mrelax-cmpxchg-loop [disabled] -mrtd [disabled] -mrtm [disabled] -msahf [enabled] -mscatter -mtune-ctrl=use_scatter -mserialize [disabled] -msgx [disabled] -msha [enabled] -msha512 [disabled] -mshstk [enabled] -mskip-rax-setup [disabled] -msm3 [disabled] -msm4 [disabled] -msoft-float [disabled] -msse [enabled] -msse2 [enabled] -msse2avx [disabled] -msse3 [enabled] -msse4 [enabled] -msse4.1 [enabled] -msse4.2 [enabled] -msse4a [enabled] -msse5 -mavx -msseregparm [disabled] -mssse3 [enabled] -mstack-arg-probe [disabled] -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard-symbol= -mstack-protector-guard= tls -mstackrealign [disabled] -mstore-max= 512 -mstringop-strategy= [default] -mstv [enabled] -mtbm [disabled] -mtls-dialect= gnu -mtls-direct-seg-refs [enabled] -mtsxldtrk [disabled] -mtune-ctrl= -mtune= znver5 -muclibc [disabled] -muintr [disabled] -munroll-only-small-loops [disabled] -musermsr [disabled] -mvaes [enabled] -mveclibabi= [default] -mvect8-ret-in-mem [disabled] -mvpclmulqdq [enabled] -mvzeroupper [disabled] -mwaitpkg [disabled] -mwbnoinvd [enabled] -mwidekl [disabled] -mx32 [disabled] -mxop [disabled] -mxsave [enabled] -mxsavec [enabled] -mxsaveopt [enabled] -mxsaves [enabled] Known assembler dialects (for use with the -masm= option): att intel Known ABIs (for use with the -mabi= option): ms sysv Known code models (for use with the -mcmodel= option): 32 kernel large medium small Valid arguments to -mfpmath=: 387 387+sse 387,sse both sse sse+387 sse,387 Known choices for mitigation against straight line speculation with -mharden-sls=: all indirect-jmp none return Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options): keep thunk thunk-extern thunk-inline Known choices for return instrumentation with -minstrument-return=: call none nop5 Known data alignment choices (for use with the -malign-data= option): abi cacheline compat Known vectorization library ABIs (for use with the -mveclibabi= option): acml svml Known address mode (for use with the -maddress-mode= option): long short Known preferred register vector length (to use with the -mprefer-vector-width= option): 128 256 512 none Known stack protector guard (for use with the -mstack-protector-guard= option): global tls Valid arguments to -mstringop-strategy=: byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop vector_loop Known TLS dialects (for use with the -mtls-dialect= option): gnu gnu2 Known valid arguments for -march= option: i386 i486 i586 pentium lakemont pentium-mmx winchip-c6 winchip2 c3 samuel-2 c3-2 nehemiah c7 esther i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d arrowlake arrowlake-s lunarlake pantherlake bonnell atom silvermont slm goldmont goldmont-plus tremont gracemont sierraforest grandridge clearwaterforest knl knm intel geode k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui yongfeng k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 generic native Known valid arguments for -mtune= option: generic i386 i486 pentium lakemont pentiumpro pentium4 nocona core2 nehalem sandybridge haswell bonnell silvermont goldmont goldmont-plus tremont sierraforest grandridge clearwaterforest knl knm skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake rocketlake graniterapids graniterapids-d arrowlake arrowlake-s pantherlake intel lujiazui yongfeng geode k6 athlon k8 amdfam10 bdver1 bdver2 bdver3 bdver4 btver1 btver2 znver1 znver2 znver3 znver4 znver5
Find the minimal -m* options needed marked as enabled in your output instead of -march=native to trigger it.
> And I also find if I not use "-march=native", it also will working fine. This reminds me of a weird LTO-related breakage on AMD Piledriver, due to microcode disabling a feature flag on only half of the CPU cores: https://bugzilla.kernel.org/show_bug.cgi?id=216211 I never heard of this happening on another CPU family, but it's worth checking, with something like: cpuid | egrep 'true|false' | sort | uniq -c | grep -v $(nproc)
Sure, it's possible, but that's also a bit of a reach at this point, given I think they meant (I might be wrong!) "with generic vs -march=native, it works vs fails".
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=897831538c5699aa4dcfe53e85f01fb6a913430d commit 897831538c5699aa4dcfe53e85f01fb6a913430d Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2024-10-10 17:31:51 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2024-10-24 09:34:24 +0000 app-editors/emacs: Restore replacing -O[3-9] by -O2 in CFLAGS This partially reverts commit 4ca8019087aab182e0f3f1211f235f128d537b8a. Bug: https://bugs.gentoo.org/839405 Closes: https://bugs.gentoo.org/941225 Signed-off-by: Ulrich Müller <ulm@gentoo.org> app-editors/emacs/emacs-26.3-r19.ebuild | 3 ++- app-editors/emacs/emacs-27.2-r17.ebuild | 4 +++- app-editors/emacs/emacs-28.2-r13.ebuild | 4 +++- app-editors/emacs/emacs-29.4.ebuild | 4 +++- app-editors/emacs/emacs-30.0.91.ebuild | 4 +++- app-editors/emacs/emacs-30.0.9999-r1.ebuild | 4 +++- app-editors/emacs/emacs-31.0.9999.ebuild | 4 +++- 7 files changed, 20 insertions(+), 7 deletions(-)
(In reply to inkflaw from comment #12) > I also find, if I use "-O2" not "-O3", it will working fine with LTO. Replacing flags -O[3-9] by -O2 for now. We can reconsider when there's an upstream fix for the problem.