From 295966135a4cd6dd3b71aaf53f6b3313857a6b59 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 19 Sep 2024 14:30:08 +0200 Subject: [PATCH] sys-devel/gcc-14.2.0: version bump (should fix Darwin24) Signed-off-by: Fabian Groffen --- sys-devel/gcc/Manifest | 3 + .../gcc-13-darwin14-fix-duplicate-libs.patch | 28 ---- .../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(-) delete mode 100644 sys-devel/gcc/files/gcc-13-darwin14-fix-duplicate-libs.patch delete mode 100644 sys-devel/gcc/files/gcc-13-darwin14-math_h.patch create mode 100644 sys-devel/gcc/gcc-14.2.0.ebuild 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 \ - " % -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 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 has indeed been fixed as expected. - -2023-08-16 Rainer Orth - - 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[@]}" +}