pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/58963: gcc: LINK_LIBGCC_SPEC snafu



The following reply was made to PR pkg/58963; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost, pkgsrc-bugs%NetBSD.org@localhost
Cc: Thomas Klausner <wiz%NetBSD.org@localhost>,
	Greg Troxel <gdt%lexort.com@localhost>,
	Jonathan Perkin <jperkin%pkgsrc.org@localhost>,
	Ryo ONODERA <ryo%tetera.org@localhost>,
	Adam Ciarcinski <aciarcinski%teonite.com@localhost>
Subject: Re: pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
Date: Mon, 6 Jan 2025 13:46:07 +0000

 This is a multi-part message in MIME format.
 --=_y8mli43iaCzhPWCedvqgQnQqZuwvU3Ud
 Content-Transfer-Encoding: quoted-printable
 
 [cc various parties who have touched lang/gcc* in recent years]
 
 I'm testing the attached patch series to restore the correct
 LINK_LIBGCC_SPEC patches.
 
 (These patches do not address the `package shouldn't REQUIRES its own
 libraries' problem jperkin@ mentioned separately at
 <https://mail-index.netbsd.org/tech-pkg/2025/01/06/msg030348.html>.)
 
 I'm hoping that by patching _all_ of the gcc packages simultaneously,
 across pkgsrc and wip, we can stamp out this problem so it doesn't
 rear it's head again.  If there are any other uncommitted copies of
 gcc packages, please let me know where to find them!
 
 
 I tried to make sure I got the PKGREVISION bumps and distinfo changes
 right but I may have missed some spots -- review welcome.
 
 
 Preliminary results suggest that these changes repair the immediate
 problem with gcc10-libs REQUIRES and similar, but I haven't tried a
 bulk build yet.  gcc12 and gcc14 are not building for me on netbsd-9
 at all, though, with problems like:
 
 In file included from ../../../gcc-12.4.0/libgcc/unwind-dw2.c:35:
 ../../../gcc-12.4.0/libgcc/unwind-pe.h:100:8: error: unknown type name '_Un=
 wind_Ptr'
   100 | static _Unwind_Ptr
       |        ^~~~~~~~~~~
 ../../../gcc-12.4.0/libgcc/unwind-pe.h:131:39: error: unknown type name '_u=
 leb128_t'
   131 | read_uleb128 (const unsigned char *p, _uleb128_t *val)
       |                                       ^~~~~~~~~~
 
 
 It is unclear to me whether the GCC_TARGET_MACHINE configuration knob
 introduced by sbd@ and jperkin@ back in 2012 is still useful, but I
 left it in just in case -- all the buildlink3.mk files still refer to
 it.  We can replace it by MACHINE_GNU_PLATFORM as a separate change if
 it's not useful any more.
 
 lang/gcc[789] use MACHINE_GNU_PLATFORM instead of GCC_TARGET_MACHINE.
 If that's right, great, we'll leave it; if not, we can patch them to
 use GCC_TARGET_MACHINE too.
 
 I note that there are still some references to $(target_noncanonical)
 in some old gcc-related packages (cross/mingw-w64-x86_64-gcc-msvcrt,
 cross/mingw-w64-x86_64-gcc, lang/g95, lang/gcc-aux, lang/gcc5-aux,
 lang/gcc6-aux), and it looks like GCC_TARGET_MACHINE was supposed to
 replace that back in 2012 or so.  Not clear to me whether these should
 be patched to use GCC_TARGET_MACHINE too.
 
 There are also a few patches to LINK_LIBGCC_SPEC that don't mention
 GCC_TARGET_MACHINE (and have spurious spaces after LINKER_RPATH_FLAG)
 but only in ancient packages, wip/gcc4[23456].  I left those alone.
 
 --=_y8mli43iaCzhPWCedvqgQnQqZuwvU3Ud
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr58963-linklibgccspec"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr58963-linklibgccspec.patch"
 
 >From 96fb076d42fa28f604e7a112bfade82dee058728 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:07:45 +0000
 Subject: [PATCH 1/4] lang/gcc10*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  lang/gcc10-aux/Makefile                      | 18 +++++++++++++++++-
  lang/gcc10-aux/distinfo                      |  2 +-
  lang/gcc10-aux/patches/patch-gcc_Makefile.in |  7 ++++---
  lang/gcc10-libs/Makefile                     |  2 +-
  lang/gcc10/Makefile                          |  2 +-
  lang/gcc10/Makefile.common                   | 16 ++++++++++++++++
  lang/gcc10/distinfo                          |  2 +-
  lang/gcc10/patches/patch-gcc_Makefile.in     |  2 +-
  8 files changed, 42 insertions(+), 9 deletions(-)
 
 diff --git a/lang/gcc10-aux/Makefile b/lang/gcc10-aux/Makefile
 index 5431c3969c09..7165bb8f4ada 100644
 --- a/lang/gcc10-aux/Makefile
 +++ b/lang/gcc10-aux/Makefile
 @@ -1,7 +1,7 @@
  # $NetBSD: Makefile,v 1.7 2023/08/15 13:49:17 tnn Exp $
 =20
  GCC_PKGNAME=3D		gcc10-aux
 -PKGREVISION=3D		1
 +PKGREVISION=3D		2
  .include		"version.mk"
 =20
  DISTNAME=3D	gcc-${GCC10_DIST_VERSION}
 @@ -184,6 +184,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  CTF_FILES_SKIP+=3D	*/gengtype	# CPU limit exceeded
 =20
  pre-configure:
 diff --git a/lang/gcc10-aux/distinfo b/lang/gcc10-aux/distinfo
 index 685734d54616..509e95bce68f 100644
 --- a/lang/gcc10-aux/distinfo
 +++ b/lang/gcc10-aux/distinfo
 @@ -8,7 +8,7 @@ SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f8=
 9c91bf15a8171f4fcaf4130
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
  SHA1 (patch-contrib_download__prerequisites) =3D 9cdcde21ab174052911447d20=
 762ddfd40aa8791
  SHA1 (patch-fixincludes_inclhack.def) =3D 7b00974d3f52a8364190a607f52a5d7e=
 8a6db41a
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_ada_Makefile.rtl) =3D 1b6a18dce5ffe752be942f6e328d487692f3=
 b33a
  SHA1 (patch-gcc_ada_adaint.c) =3D 465b3e3d6db193b2729f1d4e1c74eefcc3dc85bf
  SHA1 (patch-gcc_ada_adaint.h) =3D 57befa67b18f97345db05672f1e53e8ec70e1935
 diff --git a/lang/gcc10-aux/patches/patch-gcc_Makefile.in b/lang/gcc10-aux/=
 patches/patch-gcc_Makefile.in
 index 86b01e049fb8..dd3d3349b372 100644
 --- a/lang/gcc10-aux/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc10-aux/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2022/03/13 08:34:04 nia Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 diff --git a/lang/gcc10-libs/Makefile b/lang/gcc10-libs/Makefile
 index 2699ebcaa47e..46bd38b21afc 100644
 --- a/lang/gcc10-libs/Makefile
 +++ b/lang/gcc10-libs/Makefile
 @@ -9,7 +9,7 @@ PKGNAME=3D	${GCC_PKGNAME}-libs-${GCC10_DIST_VERSION}
  ## The PKGREVISION of this package needs to be at least 1 more than the
  ## PKGREVISION of the lang/gcc10 package so that with the dependence patte=
 rn
  ## '{gcc10,gcc10-libs}>=3D10.2.*' pkg_add will choose gcc10-libs over gcc1=
 0.
 -PKGREVISION=3D	3
 +PKGREVISION=3D	4
 =20
  CATEGORIES=3D	lang
  MASTER_SITES=3D	# empty
 diff --git a/lang/gcc10/Makefile b/lang/gcc10/Makefile
 index ea2098ab4e86..4c4963c2b350 100644
 --- a/lang/gcc10/Makefile
 +++ b/lang/gcc10/Makefile
 @@ -4,7 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC10_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc10-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 -PKGREVISION=3D	2
 +PKGREVISION=3D	3
 =20
  COMMENT=3D	The GNU Compiler Collection (GCC) - 10.0 Release Series
 =20
 diff --git a/lang/gcc10/Makefile.common b/lang/gcc10/Makefile.common
 index b4c7eb4bfc09..c5fb3a1a9f88 100644
 --- a/lang/gcc10/Makefile.common
 +++ b/lang/gcc10/Makefile.common
 @@ -138,6 +138,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/lang/gcc10/distinfo b/lang/gcc10/distinfo
 index c91f1547843d..1129568ae045 100644
 --- a/lang/gcc10/distinfo
 +++ b/lang/gcc10/distinfo
 @@ -8,7 +8,7 @@ SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f8=
 9c91bf15a8171f4fcaf4130
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
  SHA1 (patch-contrib_download__prerequisites) =3D 9cdcde21ab174052911447d20=
 762ddfd40aa8791
  SHA1 (patch-fixincludes_inclhack.def) =3D 7b00974d3f52a8364190a607f52a5d7e=
 8a6db41a
 -SHA1 (patch-gcc_Makefile.in) =3D a47571d8340702d1a86d0dfb7df654280c6a6ee6
 +SHA1 (patch-gcc_Makefile.in) =3D ae324c5df0b5c4ba4ebae280039594043bb34e12
  SHA1 (patch-gcc_config.gcc) =3D 4767d5b16794f4485879ed10e172cb2f86bc0777
  SHA1 (patch-gcc_config.host) =3D 8920ce841f6088b365c9b590e3ea9535bd880b40
  SHA1 (patch-gcc_config_aarch64_aarch64-builtins.c) =3D 87185f5c2e2dbe4195c=
 b19fe6213d2d616d5519b
 diff --git a/lang/gcc10/patches/patch-gcc_Makefile.in b/lang/gcc10/patches/=
 patch-gcc_Makefile.in
 index d2d2859edc2e..92a190e90ebc 100644
 --- a/lang/gcc10/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc10/patches/patch-gcc_Makefile.in
 @@ -11,7 +11,7 @@ Add a hack to increase the stack for genautomata on QNX.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)/@GCC_TARGET_M=
 ACHINE@/lib/%M $(LINKER_RPATH_FLAG) $(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 
 >From 8ea47e3036ba7f8a2d2dd4ada1804be81f1b164c Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:09:48 +0000
 Subject: [PATCH 2/4] lang/gcc12*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  lang/gcc12-libs/Makefile                 |  2 +-
  lang/gcc12/Makefile                      |  1 +
  lang/gcc12/Makefile.common               | 16 ++++++++++++++++
  lang/gcc12/distinfo                      |  2 +-
  lang/gcc12/patches/patch-gcc_Makefile.in |  7 ++++---
  5 files changed, 23 insertions(+), 5 deletions(-)
 
 diff --git a/lang/gcc12-libs/Makefile b/lang/gcc12-libs/Makefile
 index 3c27060f0897..b728106d3d8f 100644
 --- a/lang/gcc12-libs/Makefile
 +++ b/lang/gcc12-libs/Makefile
 @@ -9,7 +9,7 @@ PKGNAME=3D	${GCC_PKGNAME}-libs-${GCC12_DIST_VERSION}
  ## The PKGREVISION of this package needs to be at least 1 more than the
  ## PKGREVISION of the lang/gcc12 package so that with the dependence patte=
 rn
  ## '{gcc12,gcc12-libs}>=3D12.1.*' pkg_add will choose gcc12-libs over gcc1=
 2.
 -PKGREVISION=3D	1
 +PKGREVISION=3D	2
 =20
  CATEGORIES=3D	lang
  MASTER_SITES=3D	# empty
 diff --git a/lang/gcc12/Makefile b/lang/gcc12/Makefile
 index 709249c7cc98..37868d3d96cd 100644
 --- a/lang/gcc12/Makefile
 +++ b/lang/gcc12/Makefile
 @@ -4,6 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC12_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc12-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  COMMENT=3D	The GNU Compiler Collection (GCC) - 12.0 Release Series
 =20
  LANGS=3D			c
 diff --git a/lang/gcc12/Makefile.common b/lang/gcc12/Makefile.common
 index f022298cea88..e5b03ebf2aba 100644
 --- a/lang/gcc12/Makefile.common
 +++ b/lang/gcc12/Makefile.common
 @@ -150,6 +150,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/lang/gcc12/distinfo b/lang/gcc12/distinfo
 index 4ea2e1f2a3b2..087b6f33a955 100644
 --- a/lang/gcc12/distinfo
 +++ b/lang/gcc12/distinfo
 @@ -9,7 +9,7 @@ Size (gcc-12.4.0.tar.xz) =3D 83377372 bytes
  BLAKE2s (isl-0.16.1.tar.bz2) =3D 01c3fc657326e81414986eb7ede6f73e540b97009=
 745ced125cdf7f4a8d80f61
  SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4=
 fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd409=
 3076f2a041b
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config.gcc) =3D 260f187048260e539e928bb04594b6394bb03912
  SHA1 (patch-gcc_config.host) =3D bf95dd21bfdf79d173e745fbd35c9bb99fdf4087
  SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) =3D abf19e2445bce1773162b=
 ddef16cd7f41eb36827
 diff --git a/lang/gcc12/patches/patch-gcc_Makefile.in b/lang/gcc12/patches/=
 patch-gcc_Makefile.in
 index 1b21ab2c956d..4398eb10af3a 100644
 --- a/lang/gcc12/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc12/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2022/06/16 15:43:55 adam Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 
 >From 46adc39fe7e49f8b1e02fda72c6a8cf1c9b14476 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:10:24 +0000
 Subject: [PATCH 3/4] lang/gcc13*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  lang/gcc13-gnat/Makefile                      | 17 +++++++++++++++++
  lang/gcc13-gnat/distinfo                      |  2 +-
  lang/gcc13-gnat/patches/patch-gcc_Makefile.in |  7 ++++---
  lang/gcc13-libs/Makefile                      |  2 +-
  lang/gcc13/Makefile                           |  1 +
  lang/gcc13/Makefile.common                    | 16 ++++++++++++++++
  lang/gcc13/distinfo                           |  2 +-
  lang/gcc13/patches/patch-gcc_Makefile.in      |  7 ++++---
  8 files changed, 45 insertions(+), 9 deletions(-)
 
 diff --git a/lang/gcc13-gnat/Makefile b/lang/gcc13-gnat/Makefile
 index 5b7acb7d7d71..4edaaeaecdf4 100644
 --- a/lang/gcc13-gnat/Makefile
 +++ b/lang/gcc13-gnat/Makefile
 @@ -4,6 +4,7 @@ GCC_PKGNAME=3Dgcc13
  .include "../../lang/${GCC_PKGNAME}/version.mk"
 =20
  PKGNAME=3D	${GCC_PKGNAME}-gnat-${GCC13_DIST_VERSION}
 +PKGREVISION=3D	1
  COMMENT=3D	GNAT Compiler and Ada tools
  DISTNAME=3D	gcc-${GCC13_DIST_VERSION}
  CATEGORIES=3D	lang
 @@ -180,6 +181,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  CTF_FILES_SKIP+=3D	*/gengtype	# CPU limit exceeded
 =20
  TEST_TARGET=3D	-j ${MAKE_JOBS} -k check || ${TRUE}
 diff --git a/lang/gcc13-gnat/distinfo b/lang/gcc13-gnat/distinfo
 index 17b8046a1b39..c08cc3a1a172 100644
 --- a/lang/gcc13-gnat/distinfo
 +++ b/lang/gcc13-gnat/distinfo
 @@ -4,7 +4,7 @@ BLAKE2s (gcc-13.3.0.tar.xz) =3D d204b8987b4780b569f28226cbf=
 ff34ae27124e529857c36ff
  SHA512 (gcc-13.3.0.tar.xz) =3D ed5f2f4c6ed2c796fcf2c93707159e9dbd3ddb1ba06=
 3d549804dd68cdabbb6d550985ae1c8465ae9a336cfe29274a6eb0f42e21924360574ebd8e5=
 d5c7c9a801
  Size (gcc-13.3.0.tar.xz) =3D 87909952 bytes
  SHA1 (patch-fixincludes_inclhack.def) =3D 7b00974d3f52a8364190a607f52a5d7e=
 8a6db41a
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_ada_Makefile.rtl) =3D 59883834af5303b2e86a79d0df30a1a220ce=
 d895
  SHA1 (patch-gcc_ada_adaint.c) =3D 465b3e3d6db193b2729f1d4e1c74eefcc3dc85bf
  SHA1 (patch-gcc_ada_adaint.h) =3D 57befa67b18f97345db05672f1e53e8ec70e1935
 diff --git a/lang/gcc13-gnat/patches/patch-gcc_Makefile.in b/lang/gcc13-gna=
 t/patches/patch-gcc_Makefile.in
 index 3c47abe5605f..f20239fd310c 100644
 --- a/lang/gcc13-gnat/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc13-gnat/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2024/03/08 12:02:33 wiz Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 diff --git a/lang/gcc13-libs/Makefile b/lang/gcc13-libs/Makefile
 index fcaf8a3d5291..345c0410df34 100644
 --- a/lang/gcc13-libs/Makefile
 +++ b/lang/gcc13-libs/Makefile
 @@ -9,7 +9,7 @@ PKGNAME=3D	${GCC_PKGNAME}-libs-${GCC13_DIST_VERSION}
  ## The PKGREVISION of this package needs to be at least 1 more than the
  ## PKGREVISION of the lang/gcc13 package so that with the dependence patte=
 rn
  ## '{gcc13,gcc13-libs}>=3D13.1.*' pkg_add will choose gcc13-libs over gcc1=
 3.
 -PKGREVISION=3D	1
 +PKGREVISION=3D	2
 =20
  CATEGORIES=3D	lang
  MASTER_SITES=3D	# empty
 diff --git a/lang/gcc13/Makefile b/lang/gcc13/Makefile
 index 63c2bc79f584..709901136d32 100644
 --- a/lang/gcc13/Makefile
 +++ b/lang/gcc13/Makefile
 @@ -4,6 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC13_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc13-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  COMMENT=3D	The GNU Compiler Collection (GCC) - 13.0 Release Series
 =20
  LANGS=3D		c
 diff --git a/lang/gcc13/Makefile.common b/lang/gcc13/Makefile.common
 index 92634037f038..6dd8ca60ac38 100644
 --- a/lang/gcc13/Makefile.common
 +++ b/lang/gcc13/Makefile.common
 @@ -150,6 +150,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/lang/gcc13/distinfo b/lang/gcc13/distinfo
 index ab267de1754b..b36fdf5edc62 100644
 --- a/lang/gcc13/distinfo
 +++ b/lang/gcc13/distinfo
 @@ -10,7 +10,7 @@ BLAKE2s (isl-0.24.tar.xz) =3D a3013b0d39b7fe68a1b3e15dc7e=
 925b347d555348ee946a80f53
  SHA512 (isl-0.24.tar.xz) =3D ff6bdcff839e1cd473f2a0c1e4dd4a3612ec6fee4544c=
 cbc62b530a7248db2cf93b4b99bf493a86ddf2aba00e768927265d5d411f92061ea85fd7929=
 073428e8
  Size (isl-0.24.tar.xz) =3D 1930956 bytes
  SHA1 (patch-fixincludes_inclhack.def) =3D 7b00974d3f52a8364190a607f52a5d7e=
 8a6db41a
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config.host) =3D bf95dd21bfdf79d173e745fbd35c9bb99fdf4087
  SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) =3D abf19e2445bce1773162b=
 ddef16cd7f41eb36827
  SHA1 (patch-gcc_config_arm_arm.h) =3D 9d554349869d67d6393552c33a7824f0dd53=
 cb11
 diff --git a/lang/gcc13/patches/patch-gcc_Makefile.in b/lang/gcc13/patches/=
 patch-gcc_Makefile.in
 index 3cc3e1345d80..aa3bc75ed971 100644
 --- a/lang/gcc13/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc13/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2023/05/03 20:03:09 wiz Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 
 >From 41b0bd6013552425b8ad61311456afbfb67a4848 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:11:05 +0000
 Subject: [PATCH 4/4] lang/gcc14*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  lang/gcc14-libs/Makefile                 |  2 +-
  lang/gcc14/Makefile                      |  1 +
  lang/gcc14/Makefile.common               | 16 ++++++++++++++++
  lang/gcc14/distinfo                      |  2 +-
  lang/gcc14/patches/patch-gcc_Makefile.in |  7 ++++---
  5 files changed, 23 insertions(+), 5 deletions(-)
 
 diff --git a/lang/gcc14-libs/Makefile b/lang/gcc14-libs/Makefile
 index d9136a11211f..6ba1b466b9ab 100644
 --- a/lang/gcc14-libs/Makefile
 +++ b/lang/gcc14-libs/Makefile
 @@ -9,7 +9,7 @@ PKGNAME=3D	${GCC_PKGNAME}-libs-${GCC14_DIST_VERSION}
  ## The PKGREVISION of this package needs to be at least 1 more than the
  ## PKGREVISION of the lang/gcc14 package so that with the dependence patte=
 rn
  ## '{gcc14,gcc14-libs}>=3D14.1.*' pkg_add will choose gcc14-libs over gcc1=
 4.
 -PKGREVISION=3D	1
 +PKGREVISION=3D	2
 =20
  CATEGORIES=3D	lang
  MASTER_SITES=3D	# empty
 diff --git a/lang/gcc14/Makefile b/lang/gcc14/Makefile
 index 8ad9c5a03834..80d65ee7308f 100644
 --- a/lang/gcc14/Makefile
 +++ b/lang/gcc14/Makefile
 @@ -4,6 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC14_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc14-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  COMMENT=3D	The GNU Compiler Collection (GCC) - 14.0 Release Series
 =20
  LANGS=3D		c
 diff --git a/lang/gcc14/Makefile.common b/lang/gcc14/Makefile.common
 index ec006bb0a90c..275a3f23c732 100644
 --- a/lang/gcc14/Makefile.common
 +++ b/lang/gcc14/Makefile.common
 @@ -150,6 +150,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/lang/gcc14/distinfo b/lang/gcc14/distinfo
 index a47f1b83f781..b5e84e15830a 100644
 --- a/lang/gcc14/distinfo
 +++ b/lang/gcc14/distinfo
 @@ -9,7 +9,7 @@ Size (gcc-14.2.0.tar.xz) =3D 92306460 bytes
  BLAKE2s (isl-0.24.tar.xz) =3D a3013b0d39b7fe68a1b3e15dc7e925b347d555348ee9=
 46a80f5319a76973cd61
  SHA512 (isl-0.24.tar.xz) =3D ff6bdcff839e1cd473f2a0c1e4dd4a3612ec6fee4544c=
 cbc62b530a7248db2cf93b4b99bf493a86ddf2aba00e768927265d5d411f92061ea85fd7929=
 073428e8
  Size (isl-0.24.tar.xz) =3D 1930956 bytes
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config.host) =3D bf95dd21bfdf79d173e745fbd35c9bb99fdf4087
  SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) =3D abf19e2445bce1773162b=
 ddef16cd7f41eb36827
  SHA1 (patch-gcc_config_arm_arm.h) =3D 9d554349869d67d6393552c33a7824f0dd53=
 cb11
 diff --git a/lang/gcc14/patches/patch-gcc_Makefile.in b/lang/gcc14/patches/=
 patch-gcc_Makefile.in
 index 61ad8d9fbb31..3edc9a1ab6a1 100644
 --- a/lang/gcc14/patches/patch-gcc_Makefile.in
 +++ b/lang/gcc14/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2024/06/28 18:35:16 wiz Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 
 --=_y8mli43iaCzhPWCedvqgQnQqZuwvU3Ud
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr58963-linklibgccspec-wip"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr58963-linklibgccspec-wip.patch"
 
 >From f204218bc6fec7d0014763bd11a60f78aadff2ee Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:25:08 +0000
 Subject: [PATCH 1/4] gcc9snapshot: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  gcc9snapshot/Makefile                      | 23 ++++++++++++++++------
  gcc9snapshot/distinfo                      |  2 +-
  gcc9snapshot/patches/patch-gcc_Makefile.in |  7 ++++---
  3 files changed, 22 insertions(+), 10 deletions(-)
 
 diff --git a/gcc9snapshot/Makefile b/gcc9snapshot/Makefile
 index 39e6867574..2afe2c1ca7 100644
 --- a/gcc9snapshot/Makefile
 +++ b/gcc9snapshot/Makefile
 @@ -8,6 +8,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC9S_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc9-libs needs to be bump to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  CATEGORIES=3D	lang
  #MASTER_SITES=3D	${MASTER_SITE_GNU:=3Dgcc/snapshots/${GCC9S_DIST_VERSION}/}
  MASTER_SITES+=3D	ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/${GCC=
 9S_DIST_VERSION}/
 @@ -40,12 +41,6 @@ INFO_FILES=3D		yes
  UNLIMIT_RESOURCES+=3D	datasize
  UNLIMIT_RESOURCES+=3D	stacksize
 =20
 -SUBST_CLASSES+=3D		vars
 -SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 -SUBST_STAGE.vars=3D	pre-configure
 -SUBST_FILES.vars=3D	gcc/Makefile.in
 -SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 -
 =20
  .include "../../mk/bsd.prefs.mk"
 =20
 @@ -145,6 +140,22 @@ CONFIGURE_ARGS+=3D	--with-gnu-as --with-as=3D${PREFIX}=
 /bin/gas
  .  endif
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
  	${CP} ${FILESDIR}/netbsd-d.c ${WRKSRC}/gcc/config/
 diff --git a/gcc9snapshot/distinfo b/gcc9snapshot/distinfo
 index c2175d26e8..cb4d236f59 100644
 --- a/gcc9snapshot/distinfo
 +++ b/gcc9snapshot/distinfo
 @@ -7,7 +7,7 @@ RMD160 (isl-0.16.1.tar.bz2) =3D 5a99db3fe0d0a1f6bbac1ed4448=
 f2403495c55b2
  SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4=
 fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd409=
 3076f2a041b
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
  SHA1 (patch-contrib_download__prerequisites) =3D 86c6c16e0e3e3a0bcb38579a8=
 b4004f603fac1ca
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config_arm_arm.h) =3D ef381dbb70cab2f76f6ad190eaa5519240ae=
 1a02
  SHA1 (patch-gcc_config_netbsd-protos.h) =3D 5c788878832f3b48d83941d2b36401=
 abe8ece91c
  SHA1 (patch-gcc_config_t-netbsd) =3D cb39774b614f1de64684cf2f4df337e7b4042=
 7d6
 diff --git a/gcc9snapshot/patches/patch-gcc_Makefile.in b/gcc9snapshot/patc=
 hes/patch-gcc_Makefile.in
 index d52bcf4057..8674d3493d 100644
 --- a/gcc9snapshot/patches/patch-gcc_Makefile.in
 +++ b/gcc9snapshot/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2017/05/03 00:21:03 maya Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 --=20
 2.47.1
 
 
 >From 3a6682f78b7dce935e1a52c0de8e55e9d906ce1f Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:25:47 +0000
 Subject: [PATCH 2/4] gcc10*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  gcc10-aux/Makefile                          | 17 +++++++++++++++
  gcc10-aux/distinfo                          |  2 +-
  gcc10-aux/patches/patch-gcc_Makefile.in     |  7 ++++---
  gcc10snapshot/Makefile                      | 23 +++++++++++++++------
  gcc10snapshot/distinfo                      |  2 +-
  gcc10snapshot/patches/patch-gcc_Makefile.in |  7 ++++---
  6 files changed, 44 insertions(+), 14 deletions(-)
 
 diff --git a/gcc10-aux/Makefile b/gcc10-aux/Makefile
 index 6697ab701e..28d6c602d7 100644
 --- a/gcc10-aux/Makefile
 +++ b/gcc10-aux/Makefile
 @@ -5,6 +5,7 @@ GCC_PKGNAME=3D		gcc10-aux
 =20
  DISTNAME=3D	gcc-${GCC10_DIST_VERSION}
  PKGNAME=3D	${GCC_PKGNAME}-${GCC10_DIST_VERSION}
 +PKGREVISION=3D	1
  CATEGORIES=3D	lang
  MASTER_SITES=3D	${MASTER_SITE_GNU:=3Dgcc/gcc-${GCC10_DIST_VERSION}/}
  EXTRACT_SUFX=3D	.tar.xz
 @@ -177,6 +178,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  CTF_FILES_SKIP+=3D	*/gengtype	# CPU limit exceeded
 =20
  pre-configure:
 diff --git a/gcc10-aux/distinfo b/gcc10-aux/distinfo
 index 48ecb65ba1..3378032a6b 100644
 --- a/gcc10-aux/distinfo
 +++ b/gcc10-aux/distinfo
 @@ -8,7 +8,7 @@ SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f8=
 9c91bf15a8171f4fcaf4130
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
  SHA1 (patch-contrib_download__prerequisites) =3D 9cdcde21ab174052911447d20=
 762ddfd40aa8791
  SHA1 (patch-fixincludes_inclhack.def) =3D 7b00974d3f52a8364190a607f52a5d7e=
 8a6db41a
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_ada_Makefile.rtl) =3D 1b6a18dce5ffe752be942f6e328d487692f3=
 b33a
  SHA1 (patch-gcc_ada_adaint.c) =3D 465b3e3d6db193b2729f1d4e1c74eefcc3dc85bf
  SHA1 (patch-gcc_ada_adaint.h) =3D 57befa67b18f97345db05672f1e53e8ec70e1935
 diff --git a/gcc10-aux/patches/patch-gcc_Makefile.in b/gcc10-aux/patches/pa=
 tch-gcc_Makefile.in
 index cd32c67b2f..4d0a2137fb 100644
 --- a/gcc10-aux/patches/patch-gcc_Makefile.in
 +++ b/gcc10-aux/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2020/05/10 15:02:44 maya Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 diff --git a/gcc10snapshot/Makefile b/gcc10snapshot/Makefile
 index 4b3bd05ff0..58c77e4445 100644
 --- a/gcc10snapshot/Makefile
 +++ b/gcc10snapshot/Makefile
 @@ -8,6 +8,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC10S_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc10-libs needs to be bump to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  CATEGORIES=3D	lang
  #MASTER_SITES=3D	${MASTER_SITE_GNU:=3Dgcc/snapshots/${GCC10S_DIST_VERSION}=
 /}
  MASTER_SITES+=3D	ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/${GCC=
 10S_DIST_VERSION}/
 @@ -40,12 +41,6 @@ INFO_FILES=3D		yes
  UNLIMIT_RESOURCES+=3D	datasize
  UNLIMIT_RESOURCES+=3D	stacksize
 =20
 -SUBST_CLASSES+=3D		vars
 -SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 -SUBST_STAGE.vars=3D	pre-configure
 -SUBST_FILES.vars=3D	gcc/Makefile.in
 -SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 -
 =20
  .include "../../mk/bsd.prefs.mk"
 =20
 @@ -145,6 +140,22 @@ CONFIGURE_ARGS+=3D	--with-gnu-as --with-as=3D${PREFIX}=
 /bin/gas
  .  endif
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
  	${CP} ${FILESDIR}/netbsd-d.c ${WRKSRC}/gcc/config/
 diff --git a/gcc10snapshot/distinfo b/gcc10snapshot/distinfo
 index 9c6e2140e1..273ace08db 100644
 --- a/gcc10snapshot/distinfo
 +++ b/gcc10snapshot/distinfo
 @@ -7,7 +7,7 @@ RMD160 (isl-0.16.1.tar.bz2) =3D 5a99db3fe0d0a1f6bbac1ed4448=
 f2403495c55b2
  SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4=
 fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd409=
 3076f2a041b
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
  SHA1 (patch-contrib_download__prerequisites) =3D 86c6c16e0e3e3a0bcb38579a8=
 b4004f603fac1ca
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config_arm_arm.h) =3D ef381dbb70cab2f76f6ad190eaa5519240ae=
 1a02
  SHA1 (patch-gcc_config_netbsd-protos.h) =3D ff3d5c6602f57ca28d3a9c0636c522=
 4465fa9c17
  SHA1 (patch-gcc_config_x-netbsd) =3D 9dc75bfab8331b5223efc382aae5f577fb6e1=
 b7b
 diff --git a/gcc10snapshot/patches/patch-gcc_Makefile.in b/gcc10snapshot/pa=
 tches/patch-gcc_Makefile.in
 index d52bcf4057..8674d3493d 100644
 --- a/gcc10snapshot/patches/patch-gcc_Makefile.in
 +++ b/gcc10snapshot/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2017/05/03 00:21:03 maya Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 --=20
 2.47.1
 
 
 >From f455e0e2c74f9a9294d1afb040597e661c4d42a3 Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:26:25 +0000
 Subject: [PATCH 3/4] gcc12*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  gcc12/Makefile                      |  1 +
  gcc12/Makefile.common               | 16 ++++++++++++++++
  gcc12/distinfo                      |  2 +-
  gcc12/patches/patch-gcc_Makefile.in |  7 ++++---
  4 files changed, 22 insertions(+), 4 deletions(-)
 
 diff --git a/gcc12/Makefile b/gcc12/Makefile
 index 709249c7cc..37868d3d96 100644
 --- a/gcc12/Makefile
 +++ b/gcc12/Makefile
 @@ -4,6 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC12_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc12-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  COMMENT=3D	The GNU Compiler Collection (GCC) - 12.0 Release Series
 =20
  LANGS=3D			c
 diff --git a/gcc12/Makefile.common b/gcc12/Makefile.common
 index cfbb0f33c3..4d8a06aa3d 100644
 --- a/gcc12/Makefile.common
 +++ b/gcc12/Makefile.common
 @@ -161,6 +161,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/gcc12/distinfo b/gcc12/distinfo
 index 78ab02b3c4..babd6676e9 100644
 --- a/gcc12/distinfo
 +++ b/gcc12/distinfo
 @@ -15,7 +15,7 @@ Size (gcc-12.4.0.tar.xz) =3D 83377372 bytes
  BLAKE2s (isl-0.16.1.tar.bz2) =3D 01c3fc657326e81414986eb7ede6f73e540b97009=
 745ced125cdf7f4a8d80f61
  SHA512 (isl-0.16.1.tar.bz2) =3D c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4=
 fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd409=
 3076f2a041b
  Size (isl-0.16.1.tar.bz2) =3D 1626446 bytes
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_config.gcc) =3D 260f187048260e539e928bb04594b6394bb03912
  SHA1 (patch-gcc_config.host) =3D bf95dd21bfdf79d173e745fbd35c9bb99fdf4087
  SHA1 (patch-gcc_config_aarch64_aarch64-netbsd.h) =3D abf19e2445bce1773162b=
 ddef16cd7f41eb36827
 diff --git a/gcc12/patches/patch-gcc_Makefile.in b/gcc12/patches/patch-gcc_=
 Makefile.in
 index 1b21ab2c95..4398eb10af 100644
 --- a/gcc12/patches/patch-gcc_Makefile.in
 +++ b/gcc12/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2022/06/16 15:43:55 adam Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 --=20
 2.47.1
 
 
 >From b938d2b5c38bba662a718f9115af140d7abd8a0e Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 6 Jan 2025 13:26:34 +0000
 Subject: [PATCH 4/4] gcc14*: Fix LINK_LIBGCC_SPEC.
 
 PR pkg/58963: gcc: LINK_LIBGCC_SPEC snafu
 PR pkg/48740: lang/gcc44 to gcc46 linker fails because of whitespace
 ---
  gcc14/Makefile                      |  1 +
  gcc14/Makefile.common               | 16 ++++++++++++++++
  gcc14/distinfo                      |  2 +-
  gcc14/patches/patch-gcc_Makefile.in |  7 ++++---
  4 files changed, 22 insertions(+), 4 deletions(-)
 
 diff --git a/gcc14/Makefile b/gcc14/Makefile
 index 8ad9c5a038..80d65ee730 100644
 --- a/gcc14/Makefile
 +++ b/gcc14/Makefile
 @@ -4,6 +4,7 @@ PKGNAME=3D	${GCC_PKGNAME}-${GCC14_DIST_VERSION}
  ## When bumping the PKGREVISION of this package the PKGREVISION of
  ## lang/gcc14-libs needs to be bumped to be at least 1 more than the
  ## PKGREVISION of this package!
 +PKGREVISION=3D	1
  COMMENT=3D	The GNU Compiler Collection (GCC) - 14.0 Release Series
 =20
  LANGS=3D		c
 diff --git a/gcc14/Makefile.common b/gcc14/Makefile.common
 index 853225259b..7f1524bcbd 100644
 --- a/gcc14/Makefile.common
 +++ b/gcc14/Makefile.common
 @@ -147,6 +147,22 @@ SUBST_FILES.ccs=3D	contrib/make_sunver.pl
  SUBST_SED.ccs=3D		-e 's,/usr/ccs/bin,/usr/bin,g'
  .endif
 =20
 +# DO NOT REMOVE THIS SUBST.  If it fails, the corruption to
 +# patch-gcc_Makefile.in chronicled in PR pkg/58963 `gcc:
 +# LINK_LIBGCC_SPEC snafu' <https://gnats.NetBSD.org/58963> probably got
 +# replicated yet again.  You must make sure that LINK_LIBGCC_SPEC is
 +# appropriately set with @GCC_TARGET_MACHINE@ in patch-gcc_Makefile.in
 +# or similar, or confirm with a discussion on tech-pkg@ that it is no
 +# longer relevant before you remove this SUBST.
 +SUBST_CLASSES+=3D		vars
 +SUBST_MESSAGE.vars=3D	Setting target machine name path in ${SUBST_FILES.va=
 rs}
 +SUBST_STAGE.vars=3D	pre-configure
 +SUBST_FILES.vars=3D	gcc/Makefile.in
 +SUBST_VARS.vars=3D	GCC_TARGET_MACHINE
 +
 +GCC_TARGET_MACHINE?=3D	${MACHINE_GNU_PLATFORM}
 +BUILD_DEFS+=3D		GCC_TARGET_MACHINE
 +
  pre-configure:
  	${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
 =20
 diff --git a/gcc14/distinfo b/gcc14/distinfo
 index 48334294d7..e9ef70563f 100644
 --- a/gcc14/distinfo
 +++ b/gcc14/distinfo
 @@ -10,7 +10,7 @@ SHA1 (patch-configure) =3D 7d9225f1d9f0297a8cdb19aca2e584=
 fc67742226
  SHA1 (patch-configure.ac) =3D d4229d5acd148959e8bfc2fd88745d7700828f72
  SHA1 (patch-fixincludes_fixincl.x) =3D 8705769847cfecbaea393960e2894517a5a=
 05e28
  SHA1 (patch-fixincludes_inclhack.def) =3D 9a60dc8cbf702b374bf1e2a6c4e35009=
 277301d9
 -SHA1 (patch-gcc_Makefile.in) =3D c0f97c75ba1d37eae894141edd58bb36b734f651
 +SHA1 (patch-gcc_Makefile.in) =3D a31ddc27f1092cfdf5ac896ca79c8590b5aceb47
  SHA1 (patch-gcc_ada_init.c) =3D 2851bff6d8de6671de6f75d769522f09e1d4efa0
  SHA1 (patch-gcc_builtins.cc) =3D 25b826dcd3553e5e5846a75bda7425eb9ef1f247
  SHA1 (patch-gcc_c-family_c-attribs.cc) =3D a0d99cc37d3c048aa86e6d2114d0b4a=
 b719070b7
 diff --git a/gcc14/patches/patch-gcc_Makefile.in b/gcc14/patches/patch-gcc_=
 Makefile.in
 index 61ad8d9fbb..3edc9a1ab6 100644
 --- a/gcc14/patches/patch-gcc_Makefile.in
 +++ b/gcc14/patches/patch-gcc_Makefile.in
 @@ -1,7 +1,8 @@
  $NetBSD: patch-gcc_Makefile.in,v 1.1 2024/06/28 18:35:16 wiz Exp $
 =20
 -Add gcc libdir to a programs rpath so that _this gcc's_ support libraries
 -are found.
 +Ensure libgcc from this GCC is found before others.  Note that there must
 +not be a whitespace between $(LINKER_RPATH_FLAG) and the path.  Otherwise
 +the flag may be misinterpreted by the linker (e.g. Apple ld).
 =20
  --- gcc/Makefile.in.orig	2017-04-18 18:10:27.000000000 +0000
  +++ gcc/Makefile.in
 @@ -9,7 +10,7 @@ are found.
   # Language-independent files.
  =20
   DRIVER_DEFINES =3D \
 -+  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG) $(prefix)//lib/%M $(LIN=
 KER_RPATH_FLAG) $(libdir)/%M \"" \
 ++  -DLINK_LIBGCC_SPEC=3D"\"%D $(LINKER_RPATH_FLAG)$(prefix)/@GCC_TARGET_MA=
 CHINE@/lib/%M $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
     -DSTANDARD_STARTFILE_PREFIX=3D\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=3D\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=3D\"$(libexecdir)/gcc/\" \
 --=20
 2.47.1
 
 
 --=_y8mli43iaCzhPWCedvqgQnQqZuwvU3Ud--
 


Home | Main Index | Thread Index | Old Index