From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 582F7158013 for ; Tue, 1 Oct 2024 06:59:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82ECAE29BE; Tue, 1 Oct 2024 06:59:45 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 676D4E29BE for ; Tue, 1 Oct 2024 06:59:45 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7E13633BF3B for ; Tue, 1 Oct 2024 06:59:44 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1257C1A09 for ; Tue, 1 Oct 2024 06:59:43 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1727765968.c52997d9b125de280d75b169b8bc6f3964d5d051.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: c52997d9b125de280d75b169b8bc6f3964d5d051 X-VCS-Branch: master Date: Tue, 1 Oct 2024 06:59:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c862441d-ec45-41b2-8151-bf79a07f5273 X-Archives-Hash: 4ec6f20b86534f407536e5e2b938ceeb commit: c52997d9b125de280d75b169b8bc6f3964d5d051 Author: Andrei Horodniceanu proton me> AuthorDate: Mon Sep 30 16:32:52 2024 +0000 Commit: Sam James gentoo org> CommitDate: Tue Oct 1 06:59:28 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c52997d9 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 proton.me> Closes: https://github.com/gentoo/gentoo/pull/38830 Signed-off-by: Sam James gentoo.org> eclass/toolchain.eclass | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 65523041302e..a9f02d6d6a46 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1526,10 +1526,20 @@ toolchain_src_configure() { fi if in_iuse cet ; then - if [[ ${CTARGET} == i[[34567]]86-*-linux* || ${CTARGET} == x86_64-*-gnu* ]] ; then - confgcc+=( $(use_enable cet) ) - fi - [[ ${CTARGET} == aarch64-*-gnu* ]] && confgcc+=( $(use_enable cet standard-branch-protection) ) + # Usage: triple_arch triple_env cet_name + enable_cet_for() { + if [[ ${CTARGET} == ${1}-* ]] ; then + if use cet && [[ ${CTARGET} == *-${2}* ]]; then + confgcc+=( --enable-${3} ) + else + confgcc+=( --disable-${3} ) + fi + fi + } + + enable_cet_for 'i[34567]86' 'linux' 'cet' + enable_cet_for 'x86_64' 'gnu' 'cet' + enable_cet_for 'aarch64' 'gnu' 'standard-branch-protection' fi if in_iuse systemtap ; then