From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1738791-garchives=archives.gentoo.org@lists.gentoo.org>
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 finch.gentoo.org (Postfix) with ESMTPS id BF0FC1584AD
	for <garchives@archives.gentoo.org>; Mon, 21 Apr 2025 06:23:28 +0000 (UTC)
Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189])
	(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)
	(Authenticated sender: relay-lists.gentoo.org@gentoo.org)
	by smtp.gentoo.org (Postfix) with ESMTPSA id 897F13432D7
	for <garchives@archives.gentoo.org>; Mon, 21 Apr 2025 06:23:28 +0000 (UTC)
Received: from bobolink.gentoo.org (localhost [127.0.0.1])
	by bobolink.gentoo.org (Postfix) with ESMTP id A11191104B9;
	Mon, 21 Apr 2025 06:22:59 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(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 bobolink.gentoo.org (Postfix) with ESMTPS id 9BB751104B9
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Apr 2025 06:22:59 +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 519C534324A
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Apr 2025 06:22:59 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id AD7ED240A
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Apr 2025 06:22:57 +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: <1745216294.37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
X-VCS-Directories: sys-devel/gcc/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e
X-VCS-Branch: master
Date: Mon, 21 Apr 2025 06:22:57 +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: 01296159-de30-44ac-ae3c-dcd41c827243
X-Archives-Hash: ac4a669a3c200fee032abb8204a79ab2

commit:     37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 06:10:28 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 21 06:18:14 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37dded9b

sys-devel/gcc: add fixincludes patch to 15 too to fix openmp on regular cross targets

Using lu_zero's repro instructions ...
```
$ crossdev -C riscv64
$ crossdev riscv64 -s3
$ find /usr -name pthread.h # to make sure glibc isn't doing something strange
$ riscv64-unknown-linux-gnu-gcc -E - <<<"#include <pthread.h>" # this should work
$ crossdev -C riscv64
$ crossdev riscv64 -s3 --g 15.0.1_pre20250418-r1
$ find /usr -name pthread.h # to make sure glibc isn't doing something strange
$ riscv64-unknown-linux-gnu-gcc -E - <<<"#include <pthread.h>" # this should fail because it looks only on the compiler dir
```

... we see that openmp.h is missing and --disable-libgomp was passed because
our test in toolchain.eclass was failing:
```
	# Make sure target has pthreads support: bug #326757, bug #335883
	# There shouldn't be a chicken & egg problem here as openmp won't
	# build without a C library, and you can't build that w/o
	# already having a compiler...
	if ! is_crosscompile || $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null ; then
		confgcc+=( $(use_enable openmp libgomp) )
	else
		# Force disable as the configure script can be dumb, bug #359855
		confgcc+=( --disable-libgomp )
	fi
```

Adding in the gcc-13-fix-cross-fixincludes.patch patch we're already
using for other versions fixes it by adding /usr/${CHOST}/usr/include
in the search path of the stage1 crossdev GCC.

We may still want to add a workaround in toolchain.eclass like:
```
-                  $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
+                  $(tc-getCPP ${CTARGET}) -I/usr/${CTARGET}/usr/include -E - <<<"#include <pthread.h>" >& /dev/null
```

Or maybe add some warning if it failed when weren't expecting it to on some
targets.

I'll move this patch to gcc-patches at some point.

Bug: https://gcc.gnu.org/PR115416
Bug: https://bugs.gentoo.org/326757
Bug: https://bugs.gentoo.org/335883
Bug: https://bugs.gentoo.org/905118
Bug: https://bugs.gentoo.org/909453
Bug: https://bugs.gentoo.org/925204
Bug: https://bugs.gentoo.org/926059
Thanks-to: Luca Barbato <lu_zero <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild b/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
index 06d32297706e..292a75bc7f1f 100644
--- a/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
+++ b/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
@@ -52,6 +52,7 @@ src_prepare() {
 	done
 
 	toolchain_src_prepare
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply "${FILESDIR}"/${P}-PR119858.patch
 	eapply_user
 }