summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2024-03-30 22:46:49 +0100
committerFabian Groffen <grobian@gentoo.org>2024-03-30 22:46:49 +0100
commita436f2219c40b0d7fab0a3aacb6e66bd1eb33908 (patch)
tree4b21ee9e392997412c470c94db5c7294c98bfcca
parentscripts/rsync-generation/mksnapshot: also compress using lzip (diff)
downloadprefix-a436f2219c40b0d7fab0a3aacb6e66bd1eb33908.tar.gz
prefix-a436f2219c40b0d7fab0a3aacb6e66bd1eb33908.tar.bz2
prefix-a436f2219c40b0d7fab0a3aacb6e66bd1eb33908.zip
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@gentoo.org>
-rw-r--r--sys-devel/gcc/Manifest3
-rw-r--r--sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch28
-rw-r--r--sys-devel/gcc/files/gcc-13-darwin14-math_h.patch96
-rw-r--r--sys-devel/gcc/gcc-13.2.0-r1.ebuild149
4 files changed, 276 insertions, 0 deletions
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[@]}"
+}