Summary: | sys-devel/gcc-13.3.1_p20240614 - emerge fails: -fcf-protection not compatible with target | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Volker Ernst <xorrox> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | PullRequest |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=916381 https://github.com/gentoo/gentoo/pull/38830 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Build log for failed gcc emerge |
Description
Volker Ernst
2024-09-19 22:08:08 UTC
> [32m * [39;49;00mUSE: abi_x86_32 cxx elibc_glibc kernel_linux nls openmp pie sanitize ssp x86
OK, so that's fine.
But -fcf-protection appears later... why?
> checking for CET support... yes
AC_DEFUN([GCC_CET_HOST_FLAGS],[dnl
GCC_ENABLE(cet, auto, ,[enable Intel CET in host libraries],
permit yes|no|auto)
AC_MSG_CHECKING([for CET support])
[...]
case "$host" in
i[[34567]]86-*-linux* | x86_64-*-linux*)
may_have_cet=yes
cet_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fcf-protection"
case "$enable_cet" in
auto)
# Check if target supports multi-byte NOPs
# and if compiler and assembler support CET.
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[
[...]
We should really just fix this. We know the kernel isn't going to bother supporting it for 32-bit. It will for x32 but that's all.
(In reply to Sam James from comment #2) > > checking for CET support... yes > > AC_DEFUN([GCC_CET_HOST_FLAGS],[dnl > GCC_ENABLE(cet, auto, ,[enable Intel CET in host libraries], > permit yes|no|auto) > AC_MSG_CHECKING([for CET support]) > [...] > case "$host" in > i[[34567]]86-*-linux* | x86_64-*-linux*) > may_have_cet=yes > cet_save_CFLAGS="$CFLAGS" > CFLAGS="$CFLAGS -fcf-protection" > case "$enable_cet" in > auto) > # Check if target supports multi-byte NOPs > # and if compiler and assembler support CET. > AC_COMPILE_IFELSE( > [AC_LANG_PROGRAM( > [], > [ > [...] > > We should really just fix this. We know the kernel isn't going to bother > supporting it for 32-bit. It will for x32 but that's all. if in_iuse cet ; then [[ ${CTARGET} == x86_64-*-gnu* ]] && confgcc+=( $(use_enable cet) ) [[ ${CTARGET} == aarch64-*-gnu* ]] && confgcc+=( $(use_enable cet standard-branch-protection) ) fi Apparently we don't disable it for the other tuples... The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d56d8f8e35fa4f7b8d65dbd6cd535ad6ac69cc9c commit d56d8f8e35fa4f7b8d65dbd6cd535ad6ac69cc9c Author: Sam James <sam@gentoo.org> AuthorDate: 2024-09-19 22:55:44 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-09-19 22:57:19 +0000 toolchain.eclass: disable automagic CET for x86 It's not supported on 32-bit kernels anyway. This got lost in b6bf005b843e3d6ee10aa1f088d93c4f89055cc6 when wiring up arm64. Bug: https://bugs.gentoo.org/916381 Closes: https://bugs.gentoo.org/939874 Fixes: b6bf005b843e3d6ee10aa1f088d93c4f89055cc6 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c52997d9b125de280d75b169b8bc6f3964d5d051 commit c52997d9b125de280d75b169b8bc6f3964d5d051 Author: Andrei Horodniceanu <a.horodniceanu@proton.me> AuthorDate: 2024-09-30 16:32:52 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-10-01 06:59:28 +0000 toolchain.eclass: Try harder to disable cet automagic On arches that support USE=cet (those being amd64, arm64, and, x86) always pass --enable-cet or --disable-cet (or aarch64 standard-branch-protection equivalent) to prevent any configure automagic from happening. Preserve the same CTARGET logic so only pass --enable-cet if the target environment supports it and if `use cet`. Also fix the regex `i[[34567]]86` as that matches an i, followed by any of the digits from 3 to 7 or the [ character, followed by ], followed by 8, followed by 6. The regex originated in config/cet.m4 which uses [] for quotes. The automatic specifically breaks gcc[d] on musl because it prevents the code from using an internal assembly implementation for a function and deferring to using an implementation that would be provided by sys-libs/libucontext which results in undefined symbol errors: ``` /usr/lib/gcc/x86_64-pc-linux-musl/11/../../../../x86_64-pc-linux-musl/bin/ld: /usr/lib/gcc/x86_64-pc-linux-musl/11/libgphobos.a(fiber.o): in function `_D4core6thread5fiber5Fiber9initStackMFNbNiZv': (.text._D4core6thread5fiber5Fiber9initStackMFNbNiZv+0x2e): undefined reference to `getcontext' /usr/lib/gcc/x86_64-pc-linux-musl/11/../../../../x86_64-pc-linux-musl/bin/ld: (.text._D4core6thread5fiber5Fiber9initStackMFNbNiZv+0x5f): undefined reference to `makecontext' /usr/lib/gcc/x86_64-pc-linux-musl/11/../../../../x86_64-pc-linux-musl/bin/ld: /usr/lib/gcc/x86_64-pc-linux-musl/11/libgphobos.a(fiber.o): in function `_D4core6thread5fiber5Fiber12_staticCtor1FZv': (.text._D4core6thread5fiber5Fiber12_staticCtor1FZv+0x1c): undefined reference to `getcontext' ``` Bug: https://bugs.gentoo.org/939874 Closes: https://bugs.gentoo.org/918692 Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me> Closes: https://github.com/gentoo/gentoo/pull/38830 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) |