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 C32DC158041 for ; Sun, 24 Mar 2024 17:47:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E553E2A10; Sun, 24 Mar 2024 17:47:32 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DE02EE2A10 for ; Sun, 24 Mar 2024 17:47:31 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CB5D1343083 for ; Sun, 24 Mar 2024 17:47:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 138D3B6F for ; Sun, 24 Mar 2024 17:47:29 +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: <1711302428.e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf.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: e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf X-VCS-Branch: master Date: Sun, 24 Mar 2024 17:47:29 +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: 15d7c770-c6e6-4980-bca5-8b3eb6bef376 X-Archives-Hash: 1e2c7120a55cd29be9aa1c88b0ff57de commit: e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf Author: Sam James gentoo org> AuthorDate: Sun Mar 24 17:19:46 2024 +0000 Commit: Sam James gentoo org> CommitDate: Sun Mar 24 17:47:08 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e897f91e toolchain.eclass: abort if hybrid CPU detected w/ -march=native Unfortunately, the previous approach can't work. --param doesn't fully wipe out the previous value added by -march=native, so we still get a failed comparison. Users hitting this should install app-misc/resolve-march-native, run resolve-march-native, and use that in their *FLAGS instead of -march=native - at least for sys-devel/gcc via package.env, if not in make.conf. Therefore, our only real option is to just abort when we detect a problematic situation and tell users what to do. The only other idea I had was to try taskset in src_compile which feels super brittle and not sure it'd even work at all. Thanks to Andrei for testing and debugging with us on IRC & the bug. Bug: https://bugs.gentoo.org/904426 Bug: https://bugs.gentoo.org/908523 Bug: https://bugs.gentoo.org/915389 Bug: https://bugs.gentoo.org/927688 Thanks-to: Andrei Liavonchykau gmail.com> Signed-off-by: Sam James gentoo.org> eclass/toolchain.eclass | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 01fbd62dc12c..6a515f9b5c69 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1619,9 +1619,16 @@ gcc_do_filter_flags() { [[ -n ${l1_cache_size} && ${l1_cache_size} =~ ^[0-9]+$ ]] || break l1_cache_sizes[${l1_cache_size}]=1 done - # If any of them are different, just pick the first one. + # If any of them are different, abort. We can't just pass one value of + # l1-cache-size because it doesn't cancel out the -march=native one. if [[ ${#l1_cache_sizes[@]} -gt 1 ]] ; then - append-flags --param=l1-cache-size=${l1_cache_size} + eerror "Different values of l1-cache-size detected!" + eerror "GCC will fail to bootstrap when comparing files with these flags." + eerror "This CPU is likely big.little/hybrid hardware with power/efficiency cores." + eerror "Please install app-misc/resolve-march-native and run 'resolve-march-native'" + eerror "to find a safe value of CFLAGS for this CPU. Note that this may vary" + eerror "depending on the core it ran on. taskset can be used to fix the cores used." + die "Varying l1-cache-size found, aborting (bug #915389, gcc PR#111768)" fi fi