public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2017-09-25 16:39 Michael Haubenwallner
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Haubenwallner @ 2017-09-25 16:39 UTC (permalink / raw
  To: gentoo-commits

commit:     aedebf46c4e5e9c88097e000e7fc9133a5e51c3b
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 25 16:39:25 2017 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 16:39:25 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=aedebf46

sys-devel/gcc: build 5.3.0 with 7.1.0 host

Closes: https://bugs.gentoo.org/631976
Package-Manager: Portage-2.3.10-prefix, Repoman-2.3.3
RepoMan-Options: --force

 sys-devel/gcc/files/gcc-5.3.0-libc_name_p.patch | 111 ++++++++++++++++++++++++
 sys-devel/gcc/gcc-5.3.0.ebuild                  |   1 +
 2 files changed, 112 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-5.3.0-libc_name_p.patch b/sys-devel/gcc/files/gcc-5.3.0-libc_name_p.patch
new file mode 100644
index 0000000000..e87076b904
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-5.3.0-libc_name_p.patch
@@ -0,0 +1,111 @@
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=233572
+
+--- a/gcc/cp/Make-lang.in
++++ b/gcc/cp/Make-lang.in
+@@ -111,7 +111,7 @@ else
+ # deleting the $(srcdir)/cp/cfns.h file.
+ $(srcdir)/cp/cfns.h:
+ endif
+-	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
++	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
+ 		$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+ 
+ #\f
+--- a/gcc/cp/cfns.gperf
++++ b/gcc/cp/cfns.gperf
+@@ -1,3 +1,5 @@ 
++%language=C++
++%define class-name libc_name
+ %{
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ 
+@@ -16,14 +18,6 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ %}
+ %%
+ # The standard C library functions, for feeding to gperf; the result is used
+--- a/gcc/cp/cfns.h
++++ b/gcc/cp/cfns.h
+@@ -28,7 +28,7 @@ 
+ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+ #endif
+ 
+-#line 1 "cfns.gperf"
++#line 3 "cfns.gperf"
+ 
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ 
+@@ -47,25 +47,18 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+ 
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static unsigned int
+-hash (register const char *str, register unsigned int len)
++class libc_name
++{
++private:
++  static inline unsigned int hash (const char *str, unsigned int len);
++public:
++  static const char *libc_name_p (const char *str, unsigned int len);
++};
++
++inline unsigned int
++libc_name::hash (register const char *str, register unsigned int len)
+ {
+   static const unsigned short asso_values[] =
+     {
+@@ -122,14 +115,8 @@ hash (register const char *str, register
+   return hval + asso_values[(unsigned char)str[len - 1]];
+ }
+ 
+-#ifdef __GNUC__
+-__inline
+-#ifdef __GNUC_STDC_INLINE__
+-__attribute__ ((__gnu_inline__))
+-#endif
+-#endif
+ const char *
+-libc_name_p (register const char *str, register unsigned int len)
++libc_name::libc_name_p (register const char *str, register unsigned int len)
+ {
+   enum
+     {
+--- a/gcc/cp/except.c
++++ b/gcc/cp/except.c
+@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
+      unless the system headers are playing rename tricks, and if
+      they are, we don't want to be confused by them.  */
+   id = DECL_NAME (fn);
+-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
++  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
++				   IDENTIFIER_LENGTH (id));
+ }
+ 
+ /* Returns nonzero if an exception of type FROM will be caught by a

diff --git a/sys-devel/gcc/gcc-5.3.0.ebuild b/sys-devel/gcc/gcc-5.3.0.ebuild
index b93e50955f..ad35214117 100644
--- a/sys-devel/gcc/gcc-5.3.0.ebuild
+++ b/sys-devel/gcc/gcc-5.3.0.ebuild
@@ -62,6 +62,7 @@ src_prepare() {
 	# make sure 64-bits native targets don't screw up the linker paths
 	#epatch "${FILESDIR}"/4.7.1/solaris-searchpath.patch
 	epatch "${FILESDIR}"/no-libs-for-startfile.patch
+	epatch "${FILESDIR}"/${P}-libc_name_p.patch #631976
 	if use prefix; then
 		epatch "${FILESDIR}"/4.5.2/prefix-search-dirs.patch
 		# try /usr/lib32 in 32bit profile on x86_64-linux (needs


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2020-11-24  8:42 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2020-11-24  8:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ae2fe55112b538d23327e62ef28dfe5e0063b4de
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 24 08:42:49 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Nov 24 08:42:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae2fe551

sys-devel/gcc-10.1.0: add patch for macOS Big Sur

Package-Manager: Portage-3.0.10-prefix, Repoman-3.0.2
RepoMan-Options: --force
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../files/gcc-10.1.0-darwin-auth-fixincludes.patch |  22 ++++
 sys-devel/gcc/files/gcc-10.1.0-macos-bigsur.patch  | 140 +++++++++++++++++++++
 sys-devel/gcc/gcc-10.1.0-r1.ebuild                 |  19 +--
 3 files changed, 167 insertions(+), 14 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-10.1.0-darwin-auth-fixincludes.patch b/sys-devel/gcc/files/gcc-10.1.0-darwin-auth-fixincludes.patch
new file mode 100644
index 0000000000..d5e100f6c2
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-10.1.0-darwin-auth-fixincludes.patch
@@ -0,0 +1,22 @@
+--- a/fixincludes/inclhack.def
++++ b/fixincludes/inclhack.def
+@@ -1325,6 +1325,19 @@
+ };
+ 
+ /*
++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93082
++ */
++fix = {
++    hackname  = darwin_authorization;
++    mach      = "*-*-darwin*";
++    files     = Frameworks/Security.framework/Headers/Authorization.h;
++    select    = "static const size_t kAuthorizationExternalFormLength = 32;\n";
++    c_fix     = format;
++    c_fix_arg = "enum { kAuthorizationExternalFormLength = 32 };\n";
++    test_text = "static const size_t kAuthorizationExternalFormLength = 32;\n";
++};
++
++/*
+  *  For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long)
+  *  to be useful, the main math.h must use <> and not "" includes.
+  */

diff --git a/sys-devel/gcc/files/gcc-10.1.0-macos-bigsur.patch b/sys-devel/gcc/files/gcc-10.1.0-macos-bigsur.patch
new file mode 100644
index 0000000000..d2bf6a932a
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-10.1.0-macos-bigsur.patch
@@ -0,0 +1,140 @@
+From 556ab5125912fa2233986eb19d6cd995cf7de1d2 Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@sandoe.co.uk>
+Date: Fri, 31 Jul 2020 21:05:28 +0100
+Subject: [PATCH] Darwin: Darwin 20 is to be macOS 11 (Big Sur).
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+As per Nigel Tufnel's assertion "... this one goes to 11".
+
+The various parts of the code that deal with mapping Darwin versions
+to macOS (X) versions need updating to deal with  a major version of
+11.
+
+So now we have, for example:
+
+Darwin  4 => macOS (X) 10.0
+…
+Darwin 14 => macOS (X) 10.10
+...
+Darwin 19 => macOS (X) 10.15
+
+Darwin 20 => macOS  11.0
+
+Because of the historical duplication of the "10" in macOSX 10.xx and
+the number of tools that expect this, it is likely that system tools will
+allow macos11.0 and/or macosx11.0 (despite that the latter makes little
+sense).
+
+Update the link test to cover Catalina (Darwin19/10.15) and
+Big Sur (Darwin20/11.0).
+
+gcc/ChangeLog:
+
+	* config/darwin-c.c: Allow for Darwin20 to correspond to macOS 11.
+	* config/darwin-driver.c: Likewise.
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.dg/darwin-minversion-link.c: Allow for Darwin19 (macOS 10.15)
+	and Darwin20 (macOS 11.0).
+---
+ gcc/config/darwin-c.c                         |  4 ++--
+ gcc/config/darwin-driver.c                    | 21 ++++++++++++-------
+ gcc/testsuite/gcc.dg/darwin-minversion-link.c |  5 +++--
+ 3 files changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
+index e3b999e166b..9034f49908e 100644
+--- a/gcc/config/darwin-c.c
++++ b/gcc/config/darwin-c.c
+@@ -692,10 +692,10 @@ macosx_version_as_macro (void)
+   if (!version_array)
+     goto fail;
+ 
+-  if (version_array[MAJOR] != 10)
++  if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11)
+     goto fail;
+ 
+-  if (version_array[MINOR] < 10)
++  if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)
+     version_macro = version_as_legacy_macro (version_array);
+   else
+     version_macro = version_as_modern_macro (version_array);
+diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
+index 8fdd32e2858..8ae300057fd 100644
+--- a/gcc/config/darwin-driver.c
++++ b/gcc/config/darwin-driver.c
+@@ -65,7 +65,7 @@ validate_macosx_version_min (const char *version_str)
+   major = strtoul (version_str, &end, 10);
+   version_str = end + ((*end == '.') ? 1 : 0);
+ 
+-  if (major != 10) /* So far .. all MacOS 10 ... */
++  if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
+     return NULL;
+ 
+   /* Version string components must be present and numeric.  */
+@@ -104,7 +104,7 @@ validate_macosx_version_min (const char *version_str)
+   if (need_rewrite)
+     {
+       char *new_version;
+-      asprintf (&new_version, "10.%lu.%lu", minor, tiny);
++      asprintf (&new_version, "%2lu.%lu.%lu", major, minor, tiny);
+       return new_version;
+     }
+ 
+@@ -115,6 +115,12 @@ validate_macosx_version_min (const char *version_str)
+ #include <sys/sysctl.h>
+ #include "xregex.h"
+ 
++/* Determine the version of the running OS.
++   We only look at the first two components (ignoring the patch one) and
++   report NN.MM.0 where NN is currently either 10 or 11 and MM is the OS
++   minor release number.
++   If we can't parse what the kernel gives us, warn the user, and do nothing.  */
++
+ static char *
+ darwin_find_version_from_kernel (void)
+ {
+@@ -125,8 +131,6 @@ darwin_find_version_from_kernel (void)
+   char * version_p;
+   char * new_flag;
+ 
+-  /* Determine the version of the running OS.  If we can't, warn user,
+-     and do nothing.  */
+   if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
+ 	      &osversion_len, NULL, 0) == -1)
+     {
+@@ -144,10 +148,11 @@ darwin_find_version_from_kernel (void)
+     major_vers = major_vers * 10 + (*version_p++ - '0');
+   if (*version_p++ != '.')
+     goto parse_failed;
+-  
+-  /* The major kernel version number is 4 plus the second OS version
+-     component.  */
+-  if (major_vers - 4 <= 4)
++
++  /* Darwin20 sees a transition to macOS 11.  */
++  if (major_vers >= 20)
++    asprintf (&new_flag, "11.%02d.00", major_vers - 20);
++  else if (major_vers - 4 <= 4)
+     /* On 10.4 and earlier, the old linker is used which does not
+        support three-component system versions.
+        FIXME: we should not assume this - a newer linker could be used.  */
+diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+index 0a80048ba35..765fb799a91 100644
+--- a/gcc/testsuite/gcc.dg/darwin-minversion-link.c
++++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+@@ -13,8 +13,9 @@
+ /* { dg-additional-options "-mmacosx-version-min=010.011.06 -DCHECK=101106" { target *-*-darwin15* } } */
+ /* { dg-additional-options "-mmacosx-version-min=010.012.06 -DCHECK=101206" { target *-*-darwin16* } } */
+ /* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */
+-/* This next test covers 10.18 and (currently unreleased) 10.19 for now. */  
+-/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin1[89]* } } */
++/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin18* } } */
++/* { dg-additional-options "-mmacosx-version-min=010.015.06 -DCHECK=101506" { target *-*-darwin19* } } */
++/* { dg-additional-options "-mmacosx-version-min=011.000.00 -DCHECK=110000" { target *-*-darwin20 } } */
+ 
+ int
+ main ()

diff --git a/sys-devel/gcc/gcc-10.1.0-r1.ebuild b/sys-devel/gcc/gcc-10.1.0-r1.ebuild
index 4acd295e38..58dd0971ca 100644
--- a/sys-devel/gcc/gcc-10.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-10.1.0-r1.ebuild
@@ -45,20 +45,11 @@ src_prepare() {
 			libgcc/config/t-slibgcc-darwin || die
 	fi
 
-	# for Darwin, allow compilation of anything using Authorization
-	# Framework (e.g. gnutls)
-	cat >> fixincludes/inclhack.def <<- EOF
-		/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93082 */
-		fix = {
-			hackname  = darwin_authorization;
-			mach      = "*-*-darwin*";
-			files     = Frameworks/Security.framework/Headers/Authorization.h;
-			select    = "static const size_t kAuthorizationExternalFormLength = 32;\n";
-			c_fix     = format;
-			c_fix_arg = "enum { kAuthorizationExternalFormLength = 32 };\n";
-			test_text = "static const size_t kAuthorizationExternalFormLength = 32;\n";
-		};
-	EOF
+	# fix for Big Sur versioning, remove with 11
+	eapply -p1 "${FILESDIR}"/${PN}-10.1.0-macos-bigsur.patch
+
+	# fix complaint about Authorization Framework
+	eapply -p1 "${FILESDIR}"/${PN}-10.1.0-darwin-auth-fixincludes.patch
 
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2021-11-03  3:37 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2021-11-03  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     2990c38b564bf54bce0454f7c21f21db76628bc8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  3 03:37:06 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 03:37:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2990c38b

sys-devel/gcc: add patch for building on macOS 12 (Monterey)

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/files/gcc-10.3.0-monterey.patch | 80 +++++++++++++++++++++++++++
 sys-devel/gcc/gcc-10.3.0-r2.ebuild            |  2 +
 2 files changed, 82 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-10.3.0-monterey.patch b/sys-devel/gcc/files/gcc-10.3.0-monterey.patch
new file mode 100644
index 0000000000..904414dad1
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-10.3.0-monterey.patch
@@ -0,0 +1,80 @@
+https://github.com/macports/macports-ports/blob/573b82fd5df538ea2ad75e2c2373f4727ef3430c/lang/gcc11/files/patch-darwin21-support.diff
+
+From 20f61faaed3b335d792e38892d826054d2ac9f15 Mon Sep 17 00:00:00 2001
+From: Saagar Jha <saagar@saagarjha.com>
+Date: Tue, 15 Jun 2021 04:08:23 -0700
+Subject: [PATCH] Darwin, config: Amend for Darwin 21 / macOS 12.
+
+It seems that the OS major version is now tracking the kernel
+major version - 9.  Minor version tracking is unknown.
+
+Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
+Signed-off-by: Saagar Jha <saagar@saagarjha.com>
+
+gcc/ChangeLog:
+
+	* config.gcc: Adjust for Darwin21.
+	* config/darwin-c.c (macosx_version_as_macro): Likewise.
+	* config/darwin-driver.c (validate_macosx_version_min):
+	Likewise.
+	(darwin_find_version_from_kernel): Likewise.
+
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -679,9 +679,9 @@ case ${target} in
+       *-*-darwin[4-9]* | *-*-darwin1[0-9]*)
+         macos_min=`expr $darwin_maj - 4`
+         ;;
+-      *-*-darwin20*)
+-        # Darwin 20 corresponds to macOS 11.
+-        macos_maj=11
++      *-*-darwin2*)
++        # Darwin 20 corresponds to macOS 11, Darwin 21 to macOS 12.
++        macos_maj=`expr $darwin_maj - 9`
+         def_ld64=609.0
+         ;;
+       *-*-darwin)
+--- a/gcc/config/darwin-c.c
++++ b/gcc/config/darwin-c.c
+@@ -691,7 +691,7 @@ macosx_version_as_macro (void)
+   if (!version_array)
+     goto fail;
+ 
+-  if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11)
++  if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12)
+     goto fail;
+ 
+   if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)
+--- a/gcc/config/darwin-driver.c
++++ b/gcc/config/darwin-driver.c
+@@ -64,17 +64,17 @@ validate_macosx_version_min (const char *version_str)
+ 
+   major = strtoul (version_str, &end, 10);
+ 
+-  if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
++  if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */
+     return NULL;
+ 
+   /* Skip a separating period, if there's one.  */
+   version_str = end + ((*end == '.') ? 1 : 0);
+ 
+-  if (major == 11 && *end != '\0' && !ISDIGIT (version_str[0]))
+-     /* For MacOS 11, we allow just the major number, but if the minor is
++  if (major > 10 && *end != '\0' && !ISDIGIT (version_str[0]))
++     /* For macOS 11+, we allow just the major number, but if the minor is
+ 	there it must be numeric.  */
+     return NULL;
+-  else if (major == 11 && *end == '\0')
++  else if (major > 10 && *end == '\0')
+     /* We will rewrite 11 =>  11.0.0.  */
+     need_rewrite = true;
+   else if (major == 10 && (*end == '\0' || !ISDIGIT (version_str[0])))
+@@ -172,7 +172,7 @@ darwin_find_version_from_kernel (void)
+       if (minor_vers > 0)
+ 	minor_vers -= 1; /* Kernel 20.3 => macOS 11.2.  */
+       /* It's not yet clear whether patch level will be considered.  */
+-      asprintf (&new_flag, "11.%02d.00", minor_vers);
++      asprintf (&new_flag, "%d.%02d.00", major_vers - 9, minor_vers);
+     }
+   else if (major_vers - 4 <= 4)
+     /* On 10.4 and earlier, the old linker is used which does not

diff --git a/sys-devel/gcc/gcc-10.3.0-r2.ebuild b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
index b1e30bf1e1..3b0eecc0a4 100644
--- a/sys-devel/gcc/gcc-10.3.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
@@ -59,6 +59,8 @@ src_prepare() {
 
 	# fix interoperation with Xcode 12.5, bug #799170
 	eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch
+	# allow building with macOS 12
+	eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch
 }
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2021-12-05 13:47 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2021-12-05 13:47 UTC (permalink / raw
  To: gentoo-commits

commit:     921da9f661e80c8ef3c07b51b4fb6acee38f62aa
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  5 13:41:04 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec  5 13:41:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=921da9f6

sys-devel/gcc-11.2.0: add patch for Solaris

Package-Manager: Portage-3.0.21-prefix, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../gcc/files/gcc-11-illumnos-o_directory.patch    | 65 ++++++++++++++++++++++
 sys-devel/gcc/gcc-11.2.0.ebuild                    |  2 +
 2 files changed, 67 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch
new file mode 100644
index 0000000000..fd212e5f47
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch
@@ -0,0 +1,65 @@
+fix build on non Solaris 11 (including derivatives)
+
+Solaris 11 got post-release O_DIRECTORY added, so derivatives like
+Illumnos-based don't have this yet.  Nor does Solaris 10.
+Use posix_madvise instead of madvise, because the latter isn't declared
+on Solaris.
+
+--- a/c++tools/resolver.cc
++++ b/c++tools/resolver.cc
+@@ -58,6 +58,10 @@
+ #define O_CLOEXEC 0
+ #endif
+ 
++#ifndef O_DIRECTORY
++# define O_DIRECTORY 0
++#endif
++
+ #ifndef DIR_SEPARATOR
+ #define DIR_SEPARATOR '/'
+ #endif
+--- a/libcody/resolver.cc
++++ b/libcody/resolver.cc
+@@ -22,6 +22,10 @@
+ #define HAVE_FSTATAT 0
+ #endif
+ 
++#ifndef O_DIRECTORY
++# define O_DIRECTORY 0
++#endif
++
+ // Resolver code
+ 
+ #if __windows__
+--- a/libsanitizer/sanitizer_common/sanitizer_linux.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cpp
+@@ -900,6 +900,9 @@
+ #endif // !SANITIZER_SOLARIS
+ 
+ #if !SANITIZER_NETBSD
++#ifndef O_DIRECTORY
++# define O_DIRECTORY 0
++#endif
+ // ThreadLister implementation.
+ ThreadLister::ThreadLister(pid_t pid) : pid_(pid), buffer_(4096) {
+   char task_directory_path[80];
+--- a/gcc/cp/module.cc
++++ b/gcc/cp/module.cc
+@@ -1631,7 +1631,7 @@
+ 	      set_error (errno);
+ 	  else
+ 	    {
+-	      if (madvise (mapping, hdr.pos, MADV_RANDOM))
++	      if (posix_madvise (mapping, hdr.pos, MADV_RANDOM))
+ 		goto fail;
+ 
+ 	      /* These buffers are never NULL in this case.  */
+@@ -1742,7 +1742,7 @@
+     }
+   /* We'll be hopping over this randomly.  Some systems declare the
+      first parm as char *, and other declare it as void *.  */
+-  if (madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM))
++  if (posix_madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM))
+     goto fail;
+ 
+   hdr.buffer = (char *)mapping;

diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
index 05c511d65c..7a6f5581fe 100644
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ b/sys-devel/gcc/gcc-11.2.0.ebuild
@@ -61,6 +61,8 @@ src_prepare() {
 	eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch
 	# allow building with macOS 12
 	eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch
+	# allow building on Solaris derivatives
+	eapply "${FILESDIR}"/${PN}-11-illumnos-o_directory.patch
 }
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-29  7:16 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-04-29  7:16 UTC (permalink / raw
  To: gentoo-commits

commit:     6aa53d70242b7dd91fb04d1dc42da75ca582f033
Author:     Yifeng Li <tomli <AT> tomli <DOT> me>
AuthorDate: Thu Apr 27 18:59:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 29 07:15:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6aa53d70

sys-devel/gcc: revbump to disable "stdlib=" support on Darwin in 12.2.0-r2

Historically, Darwin included two C++ libraries, an outdated
GCC and its libstdc++, and a new libc++ (from clang). The old
library was the default. Thus, when building a modern C++
program using clang, the flag "stdlib=libc++" must be supplied
to clang. On the other hand, when an updated GCC is used, it
links to an updated GCC libstdc++ by default, no flag is needed.
In fact, since "stdlib=libc++" cannot be recognized by GCC,
it should not be used.

As a result, many build scripts and build systems on macOS check
if the flag "stdlib=libc++" is supported. If it's the case, the
flag is used. If it's not, no flag is added. Practically, it
creates the de-facto behavior of: If the program is built with
clang, it's linked to clang's libc++. If the program is built
with GCC, it's linked to GCC's native libstdc++. So far so good.
This is also the most reasonable behavior, as expected by most
users.

As time passes, it was realized that using GCC and clang on the
same system may create tricky conflicts, it's useful to be able
to link against clang's libc++ even if GCC is used (this is useful
beyond Darwin, e.g. for FreeBSD). Therefore, GCC now supports
"stdlib=libc++ as well.

The first immediate (but trivial) problem is a path problem.
GCC's Darwin fork (maintained by Ian) enables stdlib= support
by default (unlike upstream GCC that only conditionally enables
it when an include path "gcc_gxx_libcxx_include_dir" is passed
to GCC during build time). However, the default include path
is invalid. Building a program with "stdlib=libc++" would fail
since GCC cannot find basic C++ headers, like <vector> or
<algorithm>. For example:

    main.cpp:1:10: fatal error: algorithm: No such file or directory
        1 | #include <algorithm>
          |          ^~~~~~~~
    compilation terminated.

In principle, setting the correct clang libc++ path on macOS would
fix this problem, but it's far from our only trouble here.

Unfortunately, this consequences of this change can be far-reaching
and unexpected. In the past, if a program is compiled on clang, it's
always linked to libc++, if a program is compiled with gcc, it's
always linked to GCC's native libstdc++. But now this assumption has
been broken when GCC starts supporting "stdlib=libc++". It means that
now programs compiled by GCC will sometimes be linked to libc++, and
sometimes be linked to libstdc++, depending on two factors:

1. If a program's build system does not make any attempt to
detect the existence of "stdlib=libc++" when it's built with
GCC, it will be linked to GCC's native libstdc++. This situation
happens if the program was not ported to macOS in the past, or
if the program is designed for macOS 10.9.x and newer systems
(in which libc++ became clang's default).

2. If a program's build system attempts to detect the existence
of "stdlib=libc++", it's now linked to clang's libc++ when it's
built by GCC - when previously it would link to GCC's native
libstdc++.

Thus, when GCC is used, some programs would be linked to libstdc++,
but others may suddenly be linked to clang's libc++. depending on
the build system of the program. This would create surprising
and somewhat unpredictable situations.

The solution requires careful thought. There are four possibilities:

1. Disable stdlib= support, so the existing behavior is maintained
(more importantly, maintained without the need to patch the build
system of countless programs). The disadvantage is that end-users
would lose the ability to use stdlib=libc++ to build their own
programs when they found it's necessary.

2. Enable stdlib= support. This allows users to enjoy the
interoperability benefits of "stdlib=libc++" should it be necessary.
But now some programs would suddenly be linked to clang's libc++
when GCC is used, while others would still use GCC. This is
unexpected and would be surprising to end-users. And Since Gentoo
Prefix currently assumes a consistent GCC environment, it may
potentially create compatibility problems as well. To maintain the
historical behavior (programs built by GCC always links to GCC's
libstdc++), we need to patch the "stdlib=libc++" out of the build
system of countless programs... On the other hand, perhaps it's still
doable, since many programs are moving away from "stdlib=libc++" as
modern macOS defaults to libc++.

3. Enable stdlib= support, and pass stdlib=libstdc++ in the global
CXXFLAGS of Portage.

4. Enable stdlib= support, and pass stdlib=libc++ in the global
CXXFLAGS of Portage.

The last two options sound more reasonable, perhaps in the future,
it can be Portage's responsibility to decide which libc++ is used,
just like how it currently can decide when to use GCC or clang.
Since in GCC, new compiler flags can override previous flag, we can
force a "stdlib=" choice to allow well-defined, predictable selection
of C++ libraries. Option 2 or 1 is also imaginable, depending on
the circumstances. But we clearly need further considerations.

For now, we choose the simplest solution, disable support for "stdlib="
to maintain the existing behavior, at least as a stop-gap solution.
This may change in the future.

Closes: https://bugs.gentoo.org/905152
Signed-off-by: Yifeng Li <tomli <AT> tomli.me>
Closes: https://github.com/gentoo/prefix/pull/28
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...cc-12.2.0-disable-stdlib-option-on-darwin.patch | 151 +++++++++++++++++++++
 .../{gcc-12.2.0-r1.ebuild => gcc-12.2.0-r2.ebuild} |  11 ++
 2 files changed, 162 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch b/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch
new file mode 100644
index 0000000000..785c5b4bf9
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-12.2.0-disable-stdlib-option-on-darwin.patch
@@ -0,0 +1,151 @@
+https://bugs.gentoo.org/905152
+https://github.com/iains/gcc-12-branch/issues/21
+
+Historically, Darwin included two C++ libraries, an outdated
+GCC and its libstdc++, and a new libc++ (from clang). The old
+library was the default. Thus, when building a modern C++
+program using clang, the flag "stdlib=libc++" must be supplied
+to clang. On the other hand, when an updated GCC is used, it
+links to an updated GCC libstdc++ by default, no flag is needed.
+In fact, since "stdlib=libc++" cannot be recognized by GCC,
+it should not be used.
+
+As a result, many build scripts and build systems on macOS check
+if the flag "stdlib=libc++" is supported. If it's the case, the
+flag is used. If it's not, no flag is added. Practically, it
+creates the de-facto behavior of: If the program is built with
+clang, it's linked to clang's libc++. If the program is built
+with GCC, it's linked to GCC's native libstdc++. So far so good.
+This is also the most reasonable behavior, as expected by most
+users.
+
+As time passes, it was realized that using GCC and clang on the
+same system may create tricky conflicts, it's useful to be able
+to link against clang's libc++ even if GCC is used (this is useful
+beyond Darwin, e.g. for FreeBSD). Therefore, GCC now supports
+"stdlib=libc++ as well.
+
+The first immediate (but trivial) problem is a path problem.
+GCC's Darwin fork (maintained by Ian) enables stdlib= support
+by default (unlike upstream GCC that only conditionally enables
+it when an include path "gcc_gxx_libcxx_include_dir" is passed
+to GCC during build time). However, the default include path
+is invalid. Building a program with "stdlib=libc++" would fail
+since GCC cannot find basic C++ headers, like <vector> or
+<algorithm>. For example:
+
+    main.cpp:1:10: fatal error: algorithm: No such file or directory
+        1 | #include <algorithm>
+          |          ^~~~~~~~
+    compilation terminated.
+
+In principle, setting the correct clang libc++ path on macOS would
+fix this problem, but it's far from our only trouble here.
+
+Unfortunately, this consequences of this change can be far-reaching
+and unexpected. In the past, if a program is compiled on clang, it's
+always linked to libc++, if a program is compiled with gcc, it's
+always linked to GCC's native libstdc++. But now this assumption has
+been broken when GCC starts supporting "stdlib=libc++". It means that
+now programs compiled by GCC will sometimes be linked to libc++, and
+sometimes be linked to libstdc++, depending on two factors:
+
+1. If a program's build system does not make any attempt to
+detect the existence of "stdlib=libc++" when it's built with
+GCC, it will be linked to GCC's native libstdc++. This situation
+happens if the program was not ported to macOS in the past, or
+if the program is designed for macOS 10.9.x and newer systems
+(in which libc++ became clang's default).
+
+2. If a program's build system attempts to detect the existence
+of "stdlib=libc++", it's now linked to clang's libc++ when it's
+built by GCC - when previously it would link to GCC's native
+libstdc++.
+
+Thus, when GCC is used, some programs would be linked to libstdc++,
+but others may suddenly be linked to clang's libc++. depending on
+the build system of the program. This would create surprising
+and somewhat unpredictable situations.
+
+The solution requires careful thought. There are four possibilities:
+
+1. Disable stdlib= support, so the existing behavior is maintained
+(more importantly, maintained without the need to patch the build
+system of countless programs). The disadvantage is that end-users
+would lose the ability to use stdlib=libc++ to build their own
+programs when they found it's necessary.
+
+2. Enable stdlib= support. This allows users to enjoy the
+interoperability benefits of "stdlib=libc++" should it be necessary.
+But now some programs would suddenly be linked to clang's libc++
+when GCC is used, while others would still use GCC. This is
+unexpected and would be surprising to end-users. And Since Gentoo
+Prefix currently assumes a consistent GCC environment, it may
+potentially create compatibility problems as well. To maintain the
+historical behavior (programs built by GCC always links to GCC's
+libstdc++), we need to patch the "stdlib=libc++" out of the build
+system of countless programs... On the other hand, perhaps it's still
+doable, since many programs are moving away from "stdlib=libc++" as
+modern macOS defaults to libc++.
+
+3. Enable stdlib= support, and pass stdlib=libstdc++ in the global
+CXXFLAGS of Portage.
+
+4. Enable stdlib= support, and pass stdlib=libc++ in the global
+CXXFLAGS of Portage.
+
+The last two options sound more reasonable, perhaps in the future,
+it can be Portage's responsibility to decide which libc++ is used,
+just like how it currently can decide when to use GCC or clang.
+Since in GCC, new compiler flags can override previous flag, we can
+force a "stdlib=" choice to allow well-defined, predictable selection
+of C++ libraries. Option 2 or 1 is also imaginable, depending on
+the circumstances. But we clearly need further considerations.
+
+For now, we choose the simplest solution, disable support for "stdlib="
+to maintain the existing behavior, at least as a stop-gap solution.
+This may change in the future.
+
+diff -upr gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure
+--- gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure	2023-04-27 17:31:51.356395000 +0000
++++ gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure	2023-04-27 18:40:22.670655408 +0000
+@@ -3781,17 +3781,9 @@ if test x${gcc_gxx_libcxx_include_dir} !
+ $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h
+ 
+ else
+-  case $target in
+-    *-darwin1[1-9]* | *-darwin2*)
+-       # Default this on for Darwin versions which default to libcxx.
+-       $as_echo "#define ENABLE_STDLIB_OPTION 1" >>confdefs.h
+ 
+-       ;;
+-    *)
+-       $as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h
+-
+-       ;;
+-  esac
++$as_echo "#define ENABLE_STDLIB_OPTION 0" >>confdefs.h
++  
+ fi
+ 
+ if test x${gcc_gxx_libcxx_include_dir} = x; then
+diff -upr gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure.ac gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure.ac
+--- gcc-12-branch-gcc-12.2-darwin-r0/gcc/configure.ac	2023-04-27 17:31:47.337475138 +0000
++++ gcc-12-branch-gcc-12.2-darwin-r0.patched/gcc/configure.ac	2023-04-27 18:38:50.537799195 +0000
+@@ -249,15 +249,7 @@ if test x${gcc_gxx_libcxx_include_dir} !
+   AC_DEFINE(ENABLE_STDLIB_OPTION, 1,
+             [Define if the -stdlib= option should be enabled.])
+ else
+-  case $target in
+-    *-darwin1[[1-9]]* | *-darwin2*)
+-       # Default this on for Darwin versions which default to libcxx.
+-       AC_DEFINE(ENABLE_STDLIB_OPTION, 1)
+-       ;;
+-    *)
+-       AC_DEFINE(ENABLE_STDLIB_OPTION, 0)
+-       ;;
+-  esac
++  AC_DEFINE(ENABLE_STDLIB_OPTION, 0)
+ fi
+ 
+ if test x${gcc_gxx_libcxx_include_dir} = x; then

diff --git a/sys-devel/gcc/gcc-12.2.0-r1.ebuild b/sys-devel/gcc/gcc-12.2.0-r2.ebuild
similarity index 89%
rename from sys-devel/gcc/gcc-12.2.0-r1.ebuild
rename to sys-devel/gcc/gcc-12.2.0-r2.ebuild
index cae82d18d4..bdd8bc3afd 100644
--- a/sys-devel/gcc/gcc-12.2.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-12.2.0-r2.ebuild
@@ -76,6 +76,17 @@ src_prepare() {
 		# posix_madvise however, is
 		sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die
 	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# GCC' Darwin fork enables support for "-stdlib=libc++"
+		# unconditionally, and its default include path is invalid,
+		# causing package build failures due to missing header.
+		# But more importantly, it breaks the assumption of many build
+		# scripts and changes their CFLAGS and linking behaviors. The
+		# situation is tricky and needs careful considerations.
+		# For now, just disable support for "-stdlib=libc++".
+		eapply "${FILESDIR}"/gcc-12.2.0-disable-stdlib-option-on-darwin.patch
+	fi
 }
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-03-10 19:00 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2024-03-10 19:00 UTC (permalink / raw
  To: gentoo-commits

commit:     bf8c6e96498309932dbdc975462ef93eb0c1c347
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 18:59:51 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 18:59:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=bf8c6e96

sys-devel/gcc-13.2.0: fix bootstrap using CLT 15.3 on macOS

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../gcc/files/gcc-13-darwin14-bootstrap.patch      | 40 ++++++++++++++++++++++
 sys-devel/gcc/gcc-13.2.0.ebuild                    |  4 +++
 2 files changed, 44 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch
new file mode 100644
index 0000000000..98a92c103e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch
@@ -0,0 +1,40 @@
+disable some code-sanity checks/hacks because while bootstapping we use
+a compiler and its c++ library that does not necessarily comply
+
+This is an issue since macOS Sonoma 14.4 and/or CLT 15.3.
+
+--- a/include/safe-ctype.h
++++ b/include/safe-ctype.h
+@@ -120,6 +120,7 @@
+    So we include ctype.h here and then immediately redefine its macros.  */
+ 
+ #include <ctype.h>
++#if 0
+ #undef isalpha
+ #define isalpha(c) do_not_use_isalpha_with_safe_ctype
+ #undef isalnum
+@@ -146,5 +147,6 @@
+ #define toupper(c) do_not_use_toupper_with_safe_ctype
+ #undef tolower
+ #define tolower(c) do_not_use_tolower_with_safe_ctype
++#endif
+ 
+ #endif /* SAFE_CTYPE_H */
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -917,6 +917,7 @@
+ 
+ #if (GCC_VERSION >= 3000)
+ 
++#if 0
+ /* Note autoconf checks for prototype declarations and includes
+    system.h while doing so.  Only poison these tokens if actually
+    compiling gcc, so that the autoconf declaration tests for malloc
+@@ -933,6 +934,7 @@
+ #undef realloc
+  #pragma GCC poison malloc realloc
+ #endif
++#endif
+ 
+ /* The %m format should be used when GCC's main diagnostic functions
+    supporting %m are available, and xstrerror from libiberty

diff --git a/sys-devel/gcc/gcc-13.2.0.ebuild b/sys-devel/gcc/gcc-13.2.0.ebuild
index 65b51e7dcc..41160a6ef9 100644
--- a/sys-devel/gcc/gcc-13.2.0.ebuild
+++ b/sys-devel/gcc/gcc-13.2.0.ebuild
@@ -21,6 +21,8 @@ IANSGCCVER="gcc-13.2-darwin-r0"
 SRC_URI+=" elibc_Darwin? (
 https://github.com/iains/gcc-13-branch/archive/refs/tags/${IANSGCCVER}.tar.gz )"
 
+IUSE+="bootstrap"
+
 # Technically only if USE=hardened *too* right now, but no point in complicating it further.
 # If GCC is enabling CET by default, we need glibc to be built with support for it.
 # bug #830454
@@ -76,6 +78,8 @@ src_prepare() {
 	fi
 
 	if [[ ${CHOST} == *-darwin* ]] ; then
+		use bootstrap && eapply "${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch
+
 		# our ld64 is a slight bit different, so tweak expression to not
 		# get confused and break the build
 		sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-03-30 21:48 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2024-03-30 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     a436f2219c40b0d7fab0a3aacb6e66bd1eb33908
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 30 21:46:49 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Mar 30 21:46:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a436f221

sys-devel/gcc-13.2.0-r1: switch to original source + patch for arm64-darwin

Borrow patch from Homebrew to apply to 13.2.0 proper.
Add two patches to help interoperability with newer OS/CLTs.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/gcc/Manifest                             |   3 +
 .../files/gcc-13-darwin14-fix-duplicate-libs.patch |  28 ++++
 sys-devel/gcc/files/gcc-13-darwin14-math_h.patch   |  96 +++++++++++++
 sys-devel/gcc/gcc-13.2.0-r1.ebuild                 | 149 +++++++++++++++++++++
 4 files changed, 276 insertions(+)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 889fc273b5..cdd006894a 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -6,8 +6,11 @@ DIST gcc-12.2-darwin-r0.tar.gz 131069986 BLAKE2B 42de71c9f0802f1a43e675d3fae7341
 DIST gcc-12.2.0-musl-patches-1.tar.xz 3844 BLAKE2B 004432806696f7d0a32366270ac45695e858abee73a255e44dc6e0a225339e4cad40aab0d51dfe9a55d5aa4b4001f5726064bb2eea3212a0874b2d27e229abd7 SHA512 c354edcd641a9dfaf902a0ff4c44c75065d0cf1c36bbf6c3c35c2e23bff22b8f70bcf4458a5a0ef86371e9f2fafca8a54ca822e35820ff442c9458a2819c3606
 DIST gcc-12.2.0-patches-1.tar.xz 12864 BLAKE2B a5ae0a85dfc1b6f0bd968f0d5262ebed14ec9cdb3249e3a4c571578c54eda0e53708ee7fe8e03e506366c7f3cf7926eced9b390d9dee948c1249298c0fabd9fb SHA512 f3d793b89a2a0385d596162fb0c653d4acdf21ae418cb792c1786a01fde0391bd0719715dbf07d53636f127168f5cd99108a1dc11cf6cea889b7d82385bcc258
 DIST gcc-12.2.0.tar.xz 84645292 BLAKE2B 715574af9ad678f9dc8cfd19c866bf910c7edfd479e7e9681337feaa9b54e5d304ddb85483816b8d89754d502405823ae2eff0d1e444538763f40be8e428d8da SHA512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173
+DIST gcc-13-20240323.tar.xz 84414636 BLAKE2B cd95fc9d83d9e2477597543af5ec4e9ac82029eca6deb8cd8f82b71132e3a54e5a770be201c9e596c48f936a169f60e19979128527f41086a9a12deebbfebb26 SHA512 b25fb0efbe7346f72407ad1102d877f2ed5b40a8bff88018db4541d15cd47a849d7aeb8706be3c2ca6256fc073fe6881c8ba74db220c80b01666195d3be038d4
 DIST gcc-13.2-darwin-r0.tar.gz 137958605 BLAKE2B b6777b76baf2dc007c4080c0b7a6d448223747f0cf832e493e3b903b3bdb7f87a0e2e9cf41f9355769b178a72409b1e2866b3e73b1cc33ed0aba837f3a9e66c1 SHA512 a33177bd55d228d1df93e2a029e8af5d215ad8b2ebc84a0c90df629d6f69c5de0ed1ec9dd27bc21a62362522d83bad9a8f34407b89b13321b65f513fa2202dd2
+DIST gcc-13.2.0-arm64-darwin.patch 470156 BLAKE2B 5ba9c380d488c1ceda2f4ece68701a51d1de3d82f6aa9c96f33c4f2066e7053356c00158eec524298c16c916ff1d14bb3560eedb90f09bade44970156e86c604 SHA512 4428340c79cad8f4324bb4f5962640805f45e4a2a2be165abb0386e283f863fad9dbff8eefa508ee30ba966691f604fdadfb4d42bc9cc4c29536feaae5c1f55a
 DIST gcc-13.2.0-musl-patches-2.tar.xz 5292 BLAKE2B c057d6574d03c05854edaa9f3fd40e9149662b04f3ac7a7db3eb078d73a7b535726d1bf52e5b12736dedb2f9898ad731f2e48a6421fcfbf7b90f929dee072fcb SHA512 a691da0c87c443a5e9d23731f4005f27871c5b12bc9102873ffa24d374aa7b9fbd187c4f5635d23fa9ffb17e351e76173c2d3fdf40646e355c4cb314b538de69
+DIST gcc-13.2.0-patches-14.tar.xz 46928 BLAKE2B fce23bc5315f35b04a4976550c4b44578944a1b17e40c7553351eeb8a1ef0f3a2538da5a5e1ae6f37b784ff11bbd8a44b8f6eec542be63e34d984dee69e1cd81 SHA512 d7d52bb2915fd89c06b0134bede8db939cadbb1f2dcddf923bee2c3f9f577ff9e5e986b60420d892539edf82867a0d1bd635807814bc618b06a2b37cdaca893a
 DIST gcc-13.2.0-patches-7.tar.xz 37064 BLAKE2B 4a8700a8d44bfaa84926f8bfd0da4c5b0c0377f47fc0679456e909f7c9029b9cf1b72c0ba0bc505d9035d5c38e27f7e5b029727eaf2bc7aca417a6be966b2f43 SHA512 f440c97e6782ecb8581d41608e31a648ac426e2d870bc1d171da7794cdeff2fd0546cae0c7214e72fd3a00ead8a5c66f3f633b670b74553a2f3a40378b51f20c
 DIST gcc-13.2.0.tar.xz 87858592 BLAKE2B 0034b29d3d6cc05821f0c4253ce077805943aff7b370729dd203bda57d89c107edd657eeddc2fb1e69ea15c7b0323b961f46516c7f4af89a3ccf7fea84701be2 SHA512 d99e4826a70db04504467e349e9fbaedaa5870766cda7c5cab50cdebedc4be755ebca5b789e1232a34a20be1a0b60097de9280efe47bdb71c73251e30b0862a2
 DIST gcc-14-20240225.tar.xz 87651536 BLAKE2B 01283581b8684e0dce73b2d9a586e473f3c87753435d905e193816911edc06f9bd2a8d542a95d69f47f1c884124349520f410925b13b7bb51b913e603000d32f SHA512 f424b0935d8fdcf9ff55067467eac20a518a11c2cb14928a47e1a218cde1f4238091f25861daf417d1125c5d5d5465d32fc1b3cb04504b3ca99fe27a7a7d5792

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch b/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch
new file mode 100644
index 0000000000..06eee94341
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch
@@ -0,0 +1,28 @@
+https://raw.githubusercontent.com/Homebrew/formula-patches/e923a0cd6c0e60bb388e8a5b8cd1dcf9c3bf7758/gcc/gcc-xcode15-warnings.diff
+https://github.com/iains/gcc-13-branch/issues/11
+
+diff --git a/gcc/config/aarch64/darwin.h b/gcc/config/aarch64/darwin.h
+index 5609c569dc1..9fcbfa3d777 100644
+--- a/gcc/config/aarch64/darwin.h
++++ b/gcc/config/aarch64/darwin.h
+@@ -65,10 +65,6 @@ along with GCC; see the file COPYING3.  If not see
+ #define DARWIN_NOPIE_SPEC \
+ " %<no-pie %<fno-pie %<fno-PIE "
+ 
+-/* Hack alert - we want the exported cas etc.  */
+-#undef LIB_SPEC
+-#define LIB_SPEC "%{!static:-lSystem} -lgcc"
+-
+ /* Force the default endianness and ABI flags onto the command line
+    in order to make the other specs easier to write.  Match clang in
+    silently ignoring mdynamic-no-pic */
+diff --git a/libgfortran/libgfortran.spec.in b/libgfortran/libgfortran.spec.in
+index 367d485c230..058ee5775bf 100644
+--- a/libgfortran/libgfortran.spec.in
++++ b/libgfortran/libgfortran.spec.in
+@@ -5,4 +5,4 @@
+ #
+ 
+ %rename lib liborig
+-*lib: @LIBQUADSPEC@ @LIBM@ %(libgcc) %(liborig)
++*lib: @LIBQUADSPEC@ @LIBM@ %(liborig)

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch b/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch
new file mode 100644
index 0000000000..124dccf518
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch
@@ -0,0 +1,96 @@
+From 93f803d53b5ccaabded9d7b4512b54da81c1c616 Mon Sep 17 00:00:00 2001
+From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+Date: Thu, 17 Aug 2023 10:16:57 +0200
+Subject: [PATCH] fixincludes: Update darwin_flt_eval_method for macOS 14
+
+On macOS 14, a guard in <math.h> changed:
+
+@@ -43 +44 @@
+-#if __FLT_EVAL_METHOD__ == 0
++#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1
+@@ -49 +50 @@
+-#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
++#elif __FLT_EVAL_METHOD__ == 2
+
+Therefore the darwin_flt_eval_method fixincludes fix doesn't match any
+longer, leading to a large number of testsuite failures like
+
+/private/var/gcc/regression/master/14-gcc/build/gcc/include-fixed/math.h:69:5:
+error: #error "Unsupported value of __FLT_EVAL_METHOD__."
+
+where __FLT_EVAL_METHOD__ = 16.
+
+This patch adjusts the fix to allow for both forms.
+
+Tested with make check in fixincludes on x86_64-apple-darwin23.0.0 and
+verifying that <math.h> has indeed been fixed as expected.
+
+2023-08-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	fixincludes:
+	* inclhack.def (darwin_flt_eval_method): Handle macOS 14 guard
+	variant.
+	* fixincl.x: Regenerate.
+	* tests/base/math.h [DARWIN_FLT_EVAL_METHOD_CHECK]: Update test.
+---
+ fixincludes/fixincl.x         | 8 ++++----
+ fixincludes/inclhack.def      | 7 ++++---
+ fixincludes/tests/base/math.h | 1 +
+ 3 files changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
+index 416d2c2e3a4..e52f11d8460 100644
+--- a/fixincludes/fixincl.x
++++ b/fixincludes/fixincl.x
+@@ -3674,7 +3674,7 @@ tSCC* apzDarwin_Flt_Eval_MethodMachs[] = {
+  *  content selection pattern - do fix if pattern found
+  */
+ tSCC zDarwin_Flt_Eval_MethodSelect0[] =
+-       "^#if __FLT_EVAL_METHOD__ == 0$";
++       "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$";
+ 
+ #define    DARWIN_FLT_EVAL_METHOD_TEST_CT  1
+ static tTestDesc aDarwin_Flt_Eval_MethodTests[] = {
+@@ -3685,7 +3685,7 @@ static tTestDesc aDarwin_Flt_Eval_MethodTests[] = {
+  */
+ static const char* apzDarwin_Flt_Eval_MethodPatch[] = {
+     "format",
+-    "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16",
++    "%0 || __FLT_EVAL_METHOD__ == 16",
+     (char*)NULL };
+ 
+ /* * * * * * * * * * * * * * * * * * * * * * * * * *
+diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
+index 45e0cbc0c10..19e0ea2df66 100644
+--- a/fixincludes/inclhack.def
++++ b/fixincludes/inclhack.def
+@@ -1819,10 +1819,11 @@ fix = {
+     hackname  = darwin_flt_eval_method;
+     mach      = "*-*-darwin*";
+     files     = math.h;
+-    select    = "^#if __FLT_EVAL_METHOD__ == 0$";
++    select    = "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$";
+     c_fix     = format;
+-    c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16";
+-    test_text = "#if __FLT_EVAL_METHOD__ == 0";
++    c_fix_arg = "%0 || __FLT_EVAL_METHOD__ == 16";
++    test_text = "#if __FLT_EVAL_METHOD__ == 0\n"
++		"#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1";
+ };
+ 
+ /*
+diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h
+index 29b67579748..7b92f29a409 100644
+--- a/fixincludes/tests/base/math.h
++++ b/fixincludes/tests/base/math.h
+@@ -32,6 +32,7 @@
+ 
+ #if defined( DARWIN_FLT_EVAL_METHOD_CHECK )
+ #if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16
++#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1 || __FLT_EVAL_METHOD__ == 16
+ #endif  /* DARWIN_FLT_EVAL_METHOD_CHECK */
+ 
+ 
+-- 
+2.39.3
+

diff --git a/sys-devel/gcc/gcc-13.2.0-r1.ebuild b/sys-devel/gcc/gcc-13.2.0-r1.ebuild
new file mode 100644
index 0000000000..f04c867110
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.2.0-r1.ebuild
@@ -0,0 +1,149 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_GCC_VER="13.2.0"
+PATCH_VER="7"
+MUSL_VER="2"
+MUSL_GCC_VER="13.2.0"
+
+inherit toolchain
+
+# Don't keyword live ebuilds
+if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+	KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+# use alternate source for Apple M1 (also works for x86_64)
+SRC_URI+=" elibc_Darwin? ( https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff -> gcc-13.2.0-arm64-darwin.patch )"
+IUSE+=" bootstrap"
+
+# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+# If GCC is enabling CET by default, we need glibc to be built with support for it.
+# bug #830454
+RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	amd64? ( >=${CATEGORY}/binutils-2.30[cet(-)?] )
+	kernel_Darwin? (
+		|| ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools )
+	)"
+
+src_prepare() {
+	# apply big arm64-darwin patch first thing
+	use elibc_Darwin && eapply "${DISTDIR}"/gcc-13.2.0-arm64-darwin.patch
+
+	# make sure 64-bits native targets don't screw up the linker paths
+	eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# https://bugs.gentoo.org/898610#c17
+		# kill no_pie patch, it breaks things here
+		rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die
+		# fails on Darwin's sources
+		rm "${WORKDIR}"/patch/81_all_match.p*.patch
+	fi
+	# doesn't apply on official and Darwin sources
+	rm "${WORKDIR}"/patch/31_all_gm2_make_P_var.patch
+
+	toolchain_src_prepare
+
+	# make it have correct install_names on Darwin
+	eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch
+
+	if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+		# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107
+		sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \
+			libgcc/config/t-slibgcc-darwin || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# madvise is not available in the compatibility mode GCC uses,
+		# posix_madvise however, is
+		sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		use bootstrap && eapply "${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch
+		eapply "${FILESDIR}"/${PN}-13-darwin14-fix-duplicate-libs.patch
+		eapply "${FILESDIR}"/${PN}-13-darwin14-math_h.patch
+
+		# our ld64 is a slight bit different, so tweak expression to not
+		# get confused and break the build
+		sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die
+
+		# rip out specific macos version min
+		sed -i -e 's/-mmacosx-version-min=11.0//' \
+			libgcc/config/aarch64/t-darwin \
+			libgcc/config/aarch64/t-heap-trampoline \
+			|| die
+	fi
+
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
+	eapply_user
+}
+
+src_configure() {
+	local myconf=()
+	case ${CTARGET}:" ${USE} " in
+		powerpc*-darwin*)
+			# bug #381179
+			filter-flags "-mcpu=*" "-mtune=*"
+			# bug #657522
+			# A bug in configure checks whether -no-pie works, but the
+			# compiler doesn't pass -no-pie onto the linker if -fno-PIE
+			# isn't passed, so the configure check always finds -no-pie
+			# is accepted.  (Likewise, when -fno-PIE is passed, the
+			# compiler passes -no_pie onto the linker.)
+			# Since our linker doesn't grok this, avoid above checks to
+			# be run
+			# NOTE: later ld64 does grok -no_pie, not -no-pie (as checked)
+			export gcc_cv_c_no_fpie=no
+			export gcc_cv_no_pie=no
+		;;
+		*-darwin20)
+			# use sysroot with the linker, #756160
+			export gcc_cv_ld_sysroot=yes
+			;;
+		*-solaris*)
+			# todo: some magic for native vs. GNU linking?
+			myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile )
+			# Solaris 11 defines this in its headers, but that causes a
+			# mismatch whilst compiling, bug #657514
+			#export ac_cv_func_aligned_alloc=no
+			#export ac_cv_func_memalign=no
+			#export ac_cv_func_posix_memalign=no
+		;;
+		i[34567]86-*-linux*:*" prefix "*)
+			# to allow the linux-x86-on-amd64.patch become useful, we need
+			# to enable multilib, even if there is just one multilib option.
+			myconf+=( --enable-multilib )
+			if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then
+				# we might be on x86_64-linux, but don't do cross-compile, so
+				# tell the host-compiler to really create 32bits (for stage1)
+				# (real x86-linux-gcc also accept -m32).
+				append-flags -m32
+			fi
+		;;
+	esac
+
+	if [[ ${CHOST} == *-darwin ]] ; then
+		# GCC' Darwin fork enables support for "-stdlib=libc++"
+		# unconditionally, and its default include path is invalid,
+		# causing package build failures due to missing header.
+		# But more importantly, it breaks the assumption of many build
+		# scripts and changes their CFLAGS and linking behaviors. The
+		# situation is tricky and needs careful considerations.
+		# For now, just disable support for "-stdlib=libc++".
+		myconf+=( --with-gxx-libcxx-include-dir=no )
+	fi
+
+	# Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at
+	# least on Solaris, and AIX /bin/sh is way too slow,
+	# so force it to use $BASH (that portage uses) - it can't be EPREFIX
+	# in case that doesn't exist yet
+	export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}"
+	toolchain_src_configure "${myconf[@]}"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-09-19 12:31 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2024-09-19 12:31 UTC (permalink / raw
  To: gentoo-commits

commit:     295966135a4cd6dd3b71aaf53f6b3313857a6b59
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 19 12:30:08 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Sep 19 12:30:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=29596613

sys-devel/gcc-14.2.0: version bump (should fix Darwin24)

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/gcc/Manifest                             |   3 +
 .../files/gcc-13-darwin14-fix-duplicate-libs.patch |  28 -----
 sys-devel/gcc/files/gcc-13-darwin14-math_h.patch   |  96 --------------
 sys-devel/gcc/gcc-14.2.0.ebuild                    | 140 +++++++++++++++++++++
 4 files changed, 143 insertions(+), 124 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index f03cb5b4a1..b5ee116363 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -6,5 +6,8 @@ DIST gcc-14.1.0-arm64-darwin.patch 200436 BLAKE2B ba92f8a1586f01085775c2a0a724f5
 DIST gcc-14.1.0-macos-SDK-availability.patch 9044 BLAKE2B 783340d55590337b156d3fd866027a931bafc3bd7d6a14c7d7940e13ff6fffebe351dae3a6d98c0ba7c7c5b4f226179bb24a8714f5ca334170ab353e0c2f4be8 SHA512 6db397718d20eca0b4caf7de45358379d05e83bfc4cb4d800aaf82dd8b7994af5dbfd9ff56e3480722dfec78ad381457034552358fc1e8eeb0a5a3e3ad0e4cc1
 DIST gcc-14.1.0-musl-patches-1.tar.xz 3600 BLAKE2B 4cd920b7ca1f122cae806707564d8e45bfd48e78c88788a12a301f6068b5a5f335d8885e67479ac536c66aeaa81f2ecb7240ae56e9fc821a7246ab66b453711f SHA512 61c48d90a55dfc2129d96aee69d939d6a89f6407f69f7bd12c1a619f28989f471fd219d731958f8e62b0fd650c32300f0ad8dc06d5df23d9fc8c1a77fe210c25
 DIST gcc-14.1.0-patches-3.tar.xz 11868 BLAKE2B 06d079766bfbaddd066cd70f2d3f5e9ef17f3617fe90de4cb0a9562e6c3b2dc46d94dce03649f2e530c21e3fa0e0e6e5aae3c7b768bd08717c4f29ff29b00a04 SHA512 636a2853b5bf057fef262d54bcb250f3ebf63c600bc184cfea499783d254c462f6c0ecf5f0c5dac6634110ba0d11193fbfb96850ac27fc5a318f1d810f2231cc
+DIST gcc-14.1.0-patches-4.tar.xz 11620 BLAKE2B c819fbdea1f3bf10c8d4214d4c33cf28c1410171d2833b6f8c1225eeefe749ddb815067b3fdb750e5839761aee8d39ffc51ffb492f88e630076818a61b18362b SHA512 0d6e1b04591607dfc8022124b186ce499467c32db7667ee1a640fe2e07706597edc0e4ad5c7ebcb75c8f5fc6e45e9b9ef715402c71ff9ab21fe380007fe5d84f
 DIST gcc-14.1.0.tar.xz 92265736 BLAKE2B 7efd6574b8bca081de6e31480ec0565c6d7fb773383e8e1fdcc17e35bba2bf44b3f4f995cdbcccd001689926e96a6563ef3d099902fe3b37ab09dcf553ab0596 SHA512 e9e224f2b26646fcf038d28dfa08b94c623bc57941f99894a321d01c600f7c68aff6b8837fd25e73e540de1f8de5606e98694a62cdcdfb525ce768b3ef6879ea
+DIST gcc-14.2.0-arm64-darwin.patch 203103 BLAKE2B a040283f1ffdd0e912767b64515c18d194eb9cf2f6c55b93e7a9fab8436920b4461539ebf2482e26119001ea6f42f7294670351d853b42ca333f870365e9cc9b SHA512 c96d92289492d76f6e4e6376148c53d7e962fd15d03b1ecfe16f8036a0ff0c1e9277bf00566ecfe0d54765a679ce7d7470f6e696f8e3fe7b419000b924260fcf
+DIST gcc-14.2.0.tar.xz 92306460 BLAKE2B 87baf2a06dfa75d8fb6cd62c747ef1f57d3b9bbbe33a360d9ed3de4b4dbeaa8d920504c67e409bd9863414202c14fd854b46108e984418171205119216d03d3b SHA512 932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396
 DIST gcc-validate-failures-a447cd6dee206facb66720bdacf0c765a8b09f33.py 27537 BLAKE2B 96c7474de0bc50ab890a91551412398c979396c43aa237a4b6d8baa98ce7fda2cc9f5a755a03fd9d055d885ee2fb40ba29644a0649c24398361ce75a20fae634 SHA512 409434953351cf1f2287f1e4a4fbde5b28a27add35ddd284080acec71b33cb4ec5e1c07f41a79fac060bd6f1eedd198812495141923e410ded907429fe515f83

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch b/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch
deleted file mode 100644
index 06eee94341..0000000000
--- a/sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-https://raw.githubusercontent.com/Homebrew/formula-patches/e923a0cd6c0e60bb388e8a5b8cd1dcf9c3bf7758/gcc/gcc-xcode15-warnings.diff
-https://github.com/iains/gcc-13-branch/issues/11
-
-diff --git a/gcc/config/aarch64/darwin.h b/gcc/config/aarch64/darwin.h
-index 5609c569dc1..9fcbfa3d777 100644
---- a/gcc/config/aarch64/darwin.h
-+++ b/gcc/config/aarch64/darwin.h
-@@ -65,10 +65,6 @@ along with GCC; see the file COPYING3.  If not see
- #define DARWIN_NOPIE_SPEC \
- " %<no-pie %<fno-pie %<fno-PIE "
- 
--/* Hack alert - we want the exported cas etc.  */
--#undef LIB_SPEC
--#define LIB_SPEC "%{!static:-lSystem} -lgcc"
--
- /* Force the default endianness and ABI flags onto the command line
-    in order to make the other specs easier to write.  Match clang in
-    silently ignoring mdynamic-no-pic */
-diff --git a/libgfortran/libgfortran.spec.in b/libgfortran/libgfortran.spec.in
-index 367d485c230..058ee5775bf 100644
---- a/libgfortran/libgfortran.spec.in
-+++ b/libgfortran/libgfortran.spec.in
-@@ -5,4 +5,4 @@
- #
- 
- %rename lib liborig
--*lib: @LIBQUADSPEC@ @LIBM@ %(libgcc) %(liborig)
-+*lib: @LIBQUADSPEC@ @LIBM@ %(liborig)

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch b/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch
deleted file mode 100644
index 124dccf518..0000000000
--- a/sys-devel/gcc/files/gcc-13-darwin14-math_h.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 93f803d53b5ccaabded9d7b4512b54da81c1c616 Mon Sep 17 00:00:00 2001
-From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
-Date: Thu, 17 Aug 2023 10:16:57 +0200
-Subject: [PATCH] fixincludes: Update darwin_flt_eval_method for macOS 14
-
-On macOS 14, a guard in <math.h> changed:
-
-@@ -43 +44 @@
--#if __FLT_EVAL_METHOD__ == 0
-+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1
-@@ -49 +50 @@
--#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
-+#elif __FLT_EVAL_METHOD__ == 2
-
-Therefore the darwin_flt_eval_method fixincludes fix doesn't match any
-longer, leading to a large number of testsuite failures like
-
-/private/var/gcc/regression/master/14-gcc/build/gcc/include-fixed/math.h:69:5:
-error: #error "Unsupported value of __FLT_EVAL_METHOD__."
-
-where __FLT_EVAL_METHOD__ = 16.
-
-This patch adjusts the fix to allow for both forms.
-
-Tested with make check in fixincludes on x86_64-apple-darwin23.0.0 and
-verifying that <math.h> has indeed been fixed as expected.
-
-2023-08-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
-
-	fixincludes:
-	* inclhack.def (darwin_flt_eval_method): Handle macOS 14 guard
-	variant.
-	* fixincl.x: Regenerate.
-	* tests/base/math.h [DARWIN_FLT_EVAL_METHOD_CHECK]: Update test.
----
- fixincludes/fixincl.x         | 8 ++++----
- fixincludes/inclhack.def      | 7 ++++---
- fixincludes/tests/base/math.h | 1 +
- 3 files changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
-index 416d2c2e3a4..e52f11d8460 100644
---- a/fixincludes/fixincl.x
-+++ b/fixincludes/fixincl.x
-@@ -3674,7 +3674,7 @@ tSCC* apzDarwin_Flt_Eval_MethodMachs[] = {
-  *  content selection pattern - do fix if pattern found
-  */
- tSCC zDarwin_Flt_Eval_MethodSelect0[] =
--       "^#if __FLT_EVAL_METHOD__ == 0$";
-+       "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$";
- 
- #define    DARWIN_FLT_EVAL_METHOD_TEST_CT  1
- static tTestDesc aDarwin_Flt_Eval_MethodTests[] = {
-@@ -3685,7 +3685,7 @@ static tTestDesc aDarwin_Flt_Eval_MethodTests[] = {
-  */
- static const char* apzDarwin_Flt_Eval_MethodPatch[] = {
-     "format",
--    "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16",
-+    "%0 || __FLT_EVAL_METHOD__ == 16",
-     (char*)NULL };
- 
- /* * * * * * * * * * * * * * * * * * * * * * * * * *
-diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
-index 45e0cbc0c10..19e0ea2df66 100644
---- a/fixincludes/inclhack.def
-+++ b/fixincludes/inclhack.def
-@@ -1819,10 +1819,11 @@ fix = {
-     hackname  = darwin_flt_eval_method;
-     mach      = "*-*-darwin*";
-     files     = math.h;
--    select    = "^#if __FLT_EVAL_METHOD__ == 0$";
-+    select    = "^#if __FLT_EVAL_METHOD__ == 0( \\|\\| __FLT_EVAL_METHOD__ == -1)?$";
-     c_fix     = format;
--    c_fix_arg = "#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16";
--    test_text = "#if __FLT_EVAL_METHOD__ == 0";
-+    c_fix_arg = "%0 || __FLT_EVAL_METHOD__ == 16";
-+    test_text = "#if __FLT_EVAL_METHOD__ == 0\n"
-+		"#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1";
- };
- 
- /*
-diff --git a/fixincludes/tests/base/math.h b/fixincludes/tests/base/math.h
-index 29b67579748..7b92f29a409 100644
---- a/fixincludes/tests/base/math.h
-+++ b/fixincludes/tests/base/math.h
-@@ -32,6 +32,7 @@
- 
- #if defined( DARWIN_FLT_EVAL_METHOD_CHECK )
- #if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 16
-+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1 || __FLT_EVAL_METHOD__ == 16
- #endif  /* DARWIN_FLT_EVAL_METHOD_CHECK */
- 
- 
--- 
-2.39.3
-

diff --git a/sys-devel/gcc/gcc-14.2.0.ebuild b/sys-devel/gcc/gcc-14.2.0.ebuild
new file mode 100644
index 0000000000..1528d821c9
--- /dev/null
+++ b/sys-devel/gcc/gcc-14.2.0.ebuild
@@ -0,0 +1,140 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+TOOLCHAIN_HAS_TESTS=1
+PATCH_GCC_VER="14.1.0"
+PATCH_VER="4"
+MUSL_VER="1"
+MUSL_GCC_VER="14.1.0"
+PYTHON_COMPAT=( python3_{10..12} )
+
+if [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+	# Cheesy hack for RCs
+	MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
+	MY_P=${PN}-${MY_PV}
+	GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
+	TOOLCHAIN_SET_S=no
+	S="${WORKDIR}"/${MY_P}
+fi
+
+inherit toolchain
+
+if tc_is_live ; then
+	# Needs to be after inherit (for now?), bug #830908
+	EGIT_BRANCH=releases/gcc-$(ver_cut 1)
+elif [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+	# Don't keyword live ebuilds
+	KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+# use alternate source for Apple M1 (also works for x86_64)
+SRC_URI+=" elibc_Darwin? ( https://raw.githubusercontent.com/Homebrew/formula-patches/d5dcb918a951b2dcf2d7702db75eb29ef144f614/gcc/gcc-14.2.0.diff -> gcc-14.2.0-arm64-darwin.patch )"
+IUSE+=" bootstrap"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )"
+	DEPEND="${RDEPEND}"
+fi
+
+src_prepare() {
+	# apply big arm64-darwin patch first thing
+	use elibc_Darwin && eapply "${DISTDIR}"/${P}-arm64-darwin.patch
+
+	# make sure 64-bits native targets don't screw up the linker paths
+	eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch
+
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+	#
+	# make it have correct install_names on Darwin
+	eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch
+
+	if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+		# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107
+		sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \
+			libgcc/config/t-slibgcc-darwin || die
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# madvise is not available in the compatibility mode GCC uses,
+		# posix_madvise however, is
+		sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		use bootstrap && eapply "${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch
+
+		# our ld64 is a slight bit different, so tweak expression to not
+		# get confused and break the build
+		sed -i -e "s/EGREP 'ld64|dyld'/& | head -n1/" \
+			gcc/configure{.ac,} || die
+
+		# rip out specific macos version min
+		sed -i -e 's/-mmacosx-version-min=11.0//' \
+			libgcc/config/aarch64/t-darwin \
+			libgcc/config/aarch64/t-heap-trampoline \
+			|| die
+	fi
+
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
+	eapply_user
+}
+
+src_configure() {
+	local myconf=()
+	case ${CTARGET}:" ${USE} " in
+		powerpc*-darwin*)
+			# bug #381179
+			filter-flags "-mcpu=*" "-mtune=*"
+			# bug #657522
+			# A bug in configure checks whether -no-pie works, but the
+			# compiler doesn't pass -no-pie onto the linker if -fno-PIE
+			# isn't passed, so the configure check always finds -no-pie
+			# is accepted.  (Likewise, when -fno-PIE is passed, the
+			# compiler passes -no_pie onto the linker.)
+			# Since our linker doesn't grok this, avoid above checks to
+			# be run
+			# NOTE: later ld64 does grok -no_pie, not -no-pie (as checked)
+			export gcc_cv_c_no_fpie=no
+			export gcc_cv_no_pie=no
+		;;
+		*-darwin20)
+			# use sysroot with the linker, #756160
+			export gcc_cv_ld_sysroot=yes
+			;;
+		*-solaris*)
+			# todo: some magic for native vs. GNU linking?
+			myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile )
+		;;
+		i[34567]86-*-linux*:*" prefix "*)
+			# to allow the linux-x86-on-amd64.patch become useful, we need
+			# to enable multilib, even if there is just one multilib option.
+			myconf+=( --enable-multilib )
+			if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then
+				# we might be on x86_64-linux, but don't do cross-compile, so
+				# tell the host-compiler to really create 32bits (for stage1)
+				# (real x86-linux-gcc also accept -m32).
+				append-flags -m32
+			fi
+		;;
+	esac
+
+	# Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at
+	# least on Solaris, and AIX /bin/sh is way too slow,
+	# so force it to use $BASH (that portage uses) - it can't be EPREFIX
+	# in case that doesn't exist yet
+	export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}"
+	toolchain_src_configure "${myconf[@]}"
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-09-23 19:17 Fabian Groffen
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Groffen @ 2024-09-23 19:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b55238cc14fdf9eb9cfbd71e26ec84f855f3a259
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 23 19:16:11 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Sep 23 19:16:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b55238cc

sys-devel/gcc-14.2.0: fix interoperability with Clang 16's as

Sequoia comes with Clang 16 which requires explicitness for reading from
pipe

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/gcc/files/gcc-14.2.0-darwin-as-dash-pipe.patch | 14 ++++++++++++++
 sys-devel/gcc/gcc-14.2.0.ebuild                          |  5 ++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-14.2.0-darwin-as-dash-pipe.patch b/sys-devel/gcc/files/gcc-14.2.0-darwin-as-dash-pipe.patch
new file mode 100644
index 0000000000..a4d79d1295
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.2.0-darwin-as-dash-pipe.patch
@@ -0,0 +1,14 @@
+Since Sequoia with Clang 16, as needs - when used via pipe input
+
+--- a/gcc/config/darwin.h
++++ b/gcc/config/darwin.h
+@@ -977,6 +977,9 @@
+   { "weak_import", 0, 0, true, false, false, false,			     \
+     darwin_handle_weak_import_attribute, NULL }
+ 
++/* Since clang 16 called as 'as', it requires a dash to read pipe */
++#define AS_NEEDS_DASH_FOR_PIPED_INPUT
++
+ /* Make local constant labels linker-visible, so that if one follows a
+    weak_global constant, ld64 will be able to separate the atoms.  */
+ #undef ASM_GENERATE_INTERNAL_LABEL

diff --git a/sys-devel/gcc/gcc-14.2.0.ebuild b/sys-devel/gcc/gcc-14.2.0.ebuild
index 1528d821c9..a6df03929c 100644
--- a/sys-devel/gcc/gcc-14.2.0.ebuild
+++ b/sys-devel/gcc/gcc-14.2.0.ebuild
@@ -46,6 +46,9 @@ src_prepare() {
 	# apply big arm64-darwin patch first thing
 	use elibc_Darwin && eapply "${DISTDIR}"/${P}-arm64-darwin.patch
 
+	# run as with - on pipe (for Clang 16)
+	eapply "${FILESDIR}"/${PN}-14.2.0-darwin-as-dash-pipe.patch
+
 	# make sure 64-bits native targets don't screw up the linker paths
 	eapply "${FILESDIR}"/gcc-12-no-libs-for-startfile.patch
 
@@ -57,7 +60,7 @@ src_prepare() {
 	done
 
 	toolchain_src_prepare
-	#
+
 	# make it have correct install_names on Darwin
 	eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-09-23 19:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-03  3:37 [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-09-23 19:17 Fabian Groffen
2024-09-19 12:31 Fabian Groffen
2024-03-30 21:48 Fabian Groffen
2024-03-10 19:00 Fabian Groffen
2023-04-29  7:16 Sam James
2021-12-05 13:47 Fabian Groffen
2020-11-24  8:42 Fabian Groffen
2017-09-25 16:39 Michael Haubenwallner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox