From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1698179-garchives=archives.gentoo.org@lists.gentoo.org>
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 (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 10181158232
	for <garchives@archives.gentoo.org>; Sat,  7 Dec 2024 23:23:28 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 2C151E0FC3;
	Sat,  7 Dec 2024 23:23:27 +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 13A7BE0FA1
	for <gentoo-commits@lists.gentoo.org>; Sat,  7 Dec 2024 23:23:26 +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 EA79033BF60
	for <gentoo-commits@lists.gentoo.org>; Sat,  7 Dec 2024 23:23:24 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 4C6C9AED
	for <gentoo-commits@lists.gentoo.org>; Sat,  7 Dec 2024 23:23:23 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1733613674.ec6ccd63bb77770eeeb8eb220d66efafc91ac572.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: ec6ccd63bb77770eeeb8eb220d66efafc91ac572
X-VCS-Branch: master
Date: Sat,  7 Dec 2024 23:23:23 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: ba0d0190-118c-42a6-b814-1eaca5766e2f
X-Archives-Hash: 28789d3d55ae3bd982422bf65af63e2c

commit:     ec6ccd63bb77770eeeb8eb220d66efafc91ac572
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  7 23:21:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec  7 23:21:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec6ccd63

toolchain.eclass: pass -fcf-protection=none for stage1 builds with Clang

GCC's host_detect_local_cpu returns NULL when built with Clang (see bug
for details) so pass -fcf-protection=none for stage1 (where it doesn't
really matter anyway) to avoid a failure when -march=native ends up
resolving to nothing (b/c NULL) and then erroring out as CET isn't supported
for the baseline -m32 CPU.

Bug: https://gcc.gnu.org/PR117952
Closes: https://bugs.gentoo.org/933772
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index be8bfcddfafd..565a2f359488 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2261,6 +2261,13 @@ gcc_do_make() {
 			STAGE1_CXXFLAGS="-O2"
 		fi
 
+		# Workaround -march=native not working for stage1 with
+		# non-GCC (bug #933772).
+		if ! tc-is-gcc ; then
+			STAGE1_CFLAGS+=" $(test-flags-CC -fcf-protection=none)"
+			STAGE1_CXXFLAGS+=" $(test-flags-CXX -fcf-protection=none)"
+		fi
+
 		# We only want to use the system's CFLAGS if not building a
 		# cross-compiler.
 		STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}