Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926536 - sys-apps/kexec-tools broken with -mtune=native on zen3
Summary: sys-apps/kexec-tools broken with -mtune=native on zen3
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-09 05:01 UTC by xpenev
Modified: 2024-03-10 13:51 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xpenev 2024-03-09 05:01:35 UTC
This bug is specific to the Gentoo ebuilds. The upstream source code produces working binaries even with

        ./bootstrap && CFLAGS='-march=native -O2 -pipe' && make

on zen3. The breakage comes from the Gentoo ebuild overriding the PURGATORY compiler flags. Specifically, the following gcc flags (which are all set with -march=znver3) when applied to the PURGATORY cflags result in broken binaries:

        -mavx
        -mavx2
        -mfma
        -mbmi
        -mbmi2
        -mf16c
        -mmovbe

One way to reproduce / verify the broken state of the package is:

# CFLAGS='-O2 -pipe' ebuild /var/db/repos/gentoo/sys-apps/kexec-tools/kexec-tools-9999.ebuild clean compile
# /var/tmp/portage/sys-apps/kexec-tools-9999/work/kexec-tools-9999/build/sbin/kexec -c -d -l /boot/vmlinuz-$(uname -r) --reuse-cmdline &> ~/broken
# CFLAGS='-march=znver3 -O2 -pipe' ebuild /var/db/repos/gentoo/sys-apps/kexec-tools/kexec-tools-9999.ebuild clean compile
# /var/tmp/portage/sys-apps/kexec-tools-9999/work/kexec-tools-9999/build/sbin/kexec -c -d -l /boot/vmlinuz-$(uname -r) --reuse-cmdline &> ~/broken
# diff -u ~/working ~/broken | wc -l
644

Attempting to kexec kernels with the broken kexec tools results in a silent failure (without any kernel backtraces) and hard reset.

The diff should show ~34 lines of differences (mostly randomized buffer addresses), rather than the 644 lines of differences across various elf symbols.

Note that although I have used version 9999 as an example, the other ebuilds are also broken. It's just that kexec-tools-2.0.24 is also broken in a different way [1].

[1] https://lore.kernel.org/all/Zb9TtfGOtstr3aTj@MiWiFi-R3L-srv/T/