Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Dec 2023 18:00:48 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Harry Schmalzbauer <freebsd@omnilan.de>
Cc:        FreeBSD-STABLE <freebsd-stable@freebsd.org>
Subject:   Re: SIGILL when CPUTYPE set to anyting witjh avx and CFLAGS -O2
Message-ID:  <72107B4B-F279-471B-8A8F-5B94C5EEDA47@FreeBSD.org>
In-Reply-To: <accdf012-1b04-4227-9b0c-a78e94133fc2@omnilan.de>
References:  <accdf012-1b04-4227-9b0c-a78e94133fc2@omnilan.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29 Dec 2023, at 11:14, Harry Schmalzbauer <freebsd@omnilan.de> wrote:
>=20
> at least since 14-release, I can't compile base/ports with CPUTYPE =
post nehalem.  Any '-march' declaring AVX(*) capability leads to =
SIGILLing binaries with default -O2 CFLAGS.
> Not much of a help, but here's a ports example, but same result with =
base outcome too:
>=20
> zsh: illegal hardware instruction (core dumped) =
/var/ports-wrktree/editors/vim/work-console/vim-9.0.2143/src/vim
> kernel: pid 56502 (vim), jid 0, uid 0: exited on signal 4 (core =
dumped)
>=20
> gdb /var/ports-wrktree/editors/vim/work-console/vim-9.0.2143/src/vim =
/var/ports-wrktree/editors/vim/work-console/vim-9.0.2143/runtime/doc/vim.c=
ore
>=20
> GNU gdb (GDB) 13.2 [GDB v13.2 for FreeBSD]
> Copyright (C) 2023 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-portbld-freebsd14.0".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
>=20
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from =
/var/ports-wrktree/editors/vim/work-console/vim-9.0.2143/src/vim...
> [New LWP 154051]
> Core was generated by =
`/var/ports-wrktree/editors/vim/work-console/vim-9.0.2143/src/vim =
--clean -esX -V'.
> Program terminated with signal SIGILL, Illegal instruction.
> Privileged opcode.
> #0  0x000000000041e040 in init_yank ()
>=20
>=20
> If I compile without CFLAGS -O2 ("CFLAGS=3D -pipe"), =
-march=3Dskylake-avx512 the binary doens't crash with SIGILL.
>=20
> Is CPUTYPE supposed to stay untouched these days?

Obviously not, but are you sure your target CPU is correct? If it is =
not, the compiler may insert unsupported instructions.

In any case, for the above gdb session, try the command "disassemble" to =
see which particular instruction it crashed on. That may give more =
information.

-Dimitry




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?72107B4B-F279-471B-8A8F-5B94C5EEDA47>