From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1715784-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 6EDA4158B20
	for <garchives@archives.gentoo.org>; Fri, 07 Feb 2025 21:19:50 +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 5B49F343019
	for <garchives@archives.gentoo.org>; Fri, 07 Feb 2025 21:19:50 +0000 (UTC)
Received: from bobolink.gentoo.org (localhost [127.0.0.1])
	by bobolink.gentoo.org (Postfix) with ESMTP id 9D9C9110471;
	Fri, 07 Feb 2025 21:19:46 +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 bobolink.gentoo.org (Postfix) with ESMTPS id 97BB1110471
	for <gentoo-commits@lists.gentoo.org>; Fri, 07 Feb 2025 21:19:46 +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 45244341214
	for <gentoo-commits@lists.gentoo.org>; Fri, 07 Feb 2025 21:19:46 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D63C52654
	for <gentoo-commits@lists.gentoo.org>; Fri, 07 Feb 2025 21:19:44 +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: <1738963130.c088e880493faa16c2684fced43a2eb4cb67fe23.sam@gentoo>
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
X-VCS-Repository: proj/gcc-patches
X-VCS-Files: 15.0.0/gentoo/09_all_esysroot.patch 15.0.0/gentoo/README.history
X-VCS-Directories: 15.0.0/gentoo/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: c088e880493faa16c2684fced43a2eb4cb67fe23
X-VCS-Branch: master
Date: Fri, 07 Feb 2025 21:19:44 +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: 96072732-c786-4b19-a326-2aa42ab83b8d
X-Archives-Hash: 63b40b22684353fc9b18b98c5aa1662e

commit:     c088e880493faa16c2684fced43a2eb4cb67fe23
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  4 21:49:18 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  7 21:18:50 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c088e880

15.0.0: Update esysroot patch to fix prefix and Canadian Cross issues

Closes: https://bugs.gentoo.org/942672
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Closes: https://github.com/gentoo/gcc-patches/pull/7
Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.0.0/gentoo/09_all_esysroot.patch | 77 ++++++++++++++++++++++++-------------
 15.0.0/gentoo/README.history        |  6 ++-
 2 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/15.0.0/gentoo/09_all_esysroot.patch b/15.0.0/gentoo/09_all_esysroot.patch
index 80e0561..85a4b5e 100644
--- a/15.0.0/gentoo/09_all_esysroot.patch
+++ b/15.0.0/gentoo/09_all_esysroot.patch
@@ -1,67 +1,92 @@
-From 71e048084d32811f6e17e73b6ebadfe550ef1193 Mon Sep 17 00:00:00 2001
+From c012b20eca546ec60878058094e59267ebfba1a9 Mon Sep 17 00:00:00 2001
 From: James Le Cuirot <chewi@gentoo.org>
-Date: Sun, 4 Aug 2024 17:02:06 +0100
-Subject: [PATCH] Allow setting target sysroot with ESYSROOT env var for
+Date: Mon, 23 Dec 2024 16:50:25 +0000
+Subject: [PATCH 3/3] Allow setting target sysroot with ESYSROOT env var for
  cross-compilers
 
-The variable is ignored for native compilers. The --sysroot command line
-option takes precedence.
+The variable is ignored for native compilers, when it matches BROOT, and
+when the target machine does not match CHOST (if set). The --sysroot
+command line option takes precedence.
+
+The CHOST check is necessary for a Canadian Cross. In that case, two
+cross-compilers are invoked, but only the one matching CHOST should have
+its sysroot set by ESYSROOT.
 
 Signed-off-by: James Le Cuirot <chewi@gentoo.org>
 ---
- gcc/doc/invoke.texi | 10 ++++++++++
- gcc/gcc.cc          | 10 ++++++++++
- 2 files changed, 20 insertions(+)
+ gcc/doc/invoke.texi | 11 +++++++++++
+ gcc/gcc.cc          | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 40 insertions(+)
 
 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 0fe99ca8e..434cf30e2 100644
+index 0a7a81b20..d66f53b65 100644
 --- a/gcc/doc/invoke.texi
 +++ b/gcc/doc/invoke.texi
-@@ -19230,6 +19230,10 @@ for this option.  If your linker does not support this option, the
+@@ -19355,6 +19355,10 @@ for this option.  If your linker does not support this option, the
  header file aspect of @option{--sysroot} still works, but the
  library aspect does not.
  
 +On Gentoo Linux, this option can also be set for cross-compilers using the
-+@env{ESYSROOT} environmnent variable.  The variable is ignored for native
-+compilers.  The command line option takes precedence.
++@env{ESYSROOT} environmnent variable.  The command line option takes
++precedence.
 +
  @opindex no-sysroot-suffix
  @item --no-sysroot-suffix
  For some targets, a suffix is added to the root directory specified
-@@ -37657,6 +37661,12 @@ using GCC also uses these directories when searching for ordinary
+@@ -37590,6 +37594,13 @@ using GCC also uses these directories when searching for ordinary
  libraries for the @option{-l} option (but directories specified with
  @option{-L} come first).
  
 +@vindex ESYSROOT
 +@item ESYSROOT
 +On Gentoo Linux, this variable sets the logical root directory for headers and
-+libraries for cross-compilers.  It is ignored for native compilers.  The
-+@option{--sysroot} option takes precedence.
++libraries for cross-compilers.  It is ignored for native compilers, when it
++matches @env{BROOT}, and when the target machine does not match @env{CHOST}
++(if set).  The @option{--sysroot} option takes precedence.
 +
  @vindex LANG
  @cindex locale definition
  @item LANG
 diff --git a/gcc/gcc.cc b/gcc/gcc.cc
-index abdb40bfe..956363ddb 100644
+index 4188f0049..e88c7067f 100644
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc
-@@ -5516,6 +5516,16 @@ process_command (unsigned int decoded_options_count,
- 	      "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1);
-   free (tooldir_prefix);
+@@ -5486,6 +5486,35 @@ process_command (unsigned int decoded_options_count,
+       gcc_assert (!compare_debug_opt);
+     }
  
 +  if (*cross_compile == '1' && !target_system_root_changed)
 +    {
 +      const char *esysroot = env.get("ESYSROOT");
-+      if (esysroot && esysroot[0] != '\0' && strcmp(esysroot, "/") != 0 && (!target_system_root || strcmp(esysroot, target_system_root) != 0))
++      const char *chost = env.get("CHOST");
++      if (esysroot && (!chost || strcmp(chost, spec_machine) == 0))
 +	{
-+	  target_system_root = esysroot;
-+	  target_system_root_changed = 1;
++	  char *my_esysroot = lrealpath(esysroot);
++	  if (my_esysroot[0] == '\0')
++	    my_esysroot = xstrdup("/");
++
++	  if (!target_system_root ||
++	      !filename_eq(my_esysroot, target_system_root[0] == '\0' ? "/" : target_system_root))
++	    {
++	      const char *broot = env.get("BROOT");
++	      char *my_broot = (!broot || broot[0] == '\0') ? xstrdup("/") : lrealpath(broot);
++
++	      if (!filename_eq(my_esysroot, my_broot))
++		{
++		  target_system_root = esysroot;
++		  target_system_root_changed = 1;
++		}
++
++	      free(my_broot);
++	    }
++
++	  free(my_esysroot);
 +	}
 +    }
 +
- #if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
-   /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
-      then consider it to relocate with the rest of the GCC installation
+   /* Set up the search paths.  We add directories that we expect to
+      contain GNU Toolchain components before directories specified by
+      the machine description so that we will find GNU components (like
 -- 
-2.45.2
+2.47.1
 

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 975777d..bac4f3e 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+45	????
+
+	U 09_all_esysroot.patch
+
 44	2 February 2025
 
 	- 83_all-gcc-d-give-dependency-files-better-filenames.patch
@@ -117,7 +121,7 @@
 
 21	1 November 2024
 
-	+ 31_all_time64.patch	
+	+ 31_all_time64.patch
 
 20	28 October 2024