From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1715783-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 A8E36158B20
	for <garchives@archives.gentoo.org>; Fri, 07 Feb 2025 21:19:47 +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 8AE0C340906
	for <garchives@archives.gentoo.org>; Fri, 07 Feb 2025 21:19:47 +0000 (UTC)
Received: from bobolink.gentoo.org (localhost [127.0.0.1])
	by bobolink.gentoo.org (Postfix) with ESMTP id 8F9721103CB;
	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 84E481103CB
	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 32CE6340BDE
	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 C2BBCE65
	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: <1738963097.7cf67113c79bdeac5e482e290adf47e473d92b8f.sam@gentoo>
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 14.2.0/gentoo/
X-VCS-Repository: proj/gcc-patches
X-VCS-Files: 14.2.0/gentoo/09_all_esysroot.patch 14.2.0/gentoo/README.history
X-VCS-Directories: 14.2.0/gentoo/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 7cf67113c79bdeac5e482e290adf47e473d92b8f
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: 035cb9d8-b18c-4c30-948d-cc757e3e50ce
X-Archives-Hash: a5111c3ce0fa0fcdefbfb8f7ec932a7b

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

14.2.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>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 14.2.0/gentoo/09_all_esysroot.patch | 75 ++++++++++++++++++++++++-------------
 14.2.0/gentoo/README.history        |  4 ++
 2 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/14.2.0/gentoo/09_all_esysroot.patch b/14.2.0/gentoo/09_all_esysroot.patch
index 8dcfd22..f9c5bed 100644
--- a/14.2.0/gentoo/09_all_esysroot.patch
+++ b/14.2.0/gentoo/09_all_esysroot.patch
@@ -1,20 +1,25 @@
-From a2e98f3928a4bef1f9a027f8af22b019beff9600 Mon Sep 17 00:00:00 2001
+From 55f0825fc17d07a5e6d0ab5ae363f91f834946fa 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 f82f7d281..2f03b080d 100644
+index f82f7d281..8136aa661 100644
 --- a/gcc/doc/invoke.texi
 +++ b/gcc/doc/invoke.texi
 @@ -19027,6 +19027,10 @@ for this option.  If your linker does not support this option, the
@@ -22,46 +27,66 @@ index f82f7d281..2f03b080d 100644
  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
-@@ -37409,6 +37413,12 @@ using GCC also uses these directories when searching for ordinary
+@@ -37409,6 +37413,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 728332b81..06d8c469b 100644
+index 20044bc3a..823067267 100644
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc
-@@ -5501,6 +5501,16 @@ process_command (unsigned int decoded_options_count,
- 	      "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1);
-   free (tooldir_prefix);
+@@ -5460,6 +5460,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/14.2.0/gentoo/README.history b/14.2.0/gentoo/README.history
index 2c13e72..1e904ec 100644
--- a/14.2.0/gentoo/README.history
+++ b/14.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+8	????
+
+	U 09_all_esysroot.patch
+
 7	24 Dec 2024
 
 	U 70_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch