From d4e1932a3b5777a95f4ffd680c1a377d72e709e3 Mon Sep 17 00:00:00 2001 From: "Andreas K. Hüttel" Date: Sun, 3 Sep 2023 17:44:21 +0200 Subject: sys-devel/gcc: new package, add 13.2.1_p20230826 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas K. Hüttel --- sys-devel/gcc/Manifest | 3 + .../gcc/files/gcc-13-fix-cross-fixincludes.patch | 19 ++++ .../gcc-14.0.0_pre20230806-fix-bootstrap.patch | 105 +++++++++++++++++++ sys-devel/gcc/files/gcc-configure-LANG.patch | 64 ++++++++++++ sys-devel/gcc/files/gcc-configure-texinfo.patch | 16 +++ sys-devel/gcc/gcc-13.2.1_p20230826.ebuild | 65 ++++++++++++ sys-devel/gcc/metadata.xml | 113 +++++++++++++++++++++ 7 files changed, 385 insertions(+) create mode 100644 sys-devel/gcc/Manifest create mode 100644 sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch create mode 100644 sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch create mode 100644 sys-devel/gcc/files/gcc-configure-LANG.patch create mode 100644 sys-devel/gcc/files/gcc-configure-texinfo.patch create mode 100644 sys-devel/gcc/gcc-13.2.1_p20230826.ebuild create mode 100644 sys-devel/gcc/metadata.xml diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest new file mode 100644 index 0000000..225d8e2 --- /dev/null +++ b/sys-devel/gcc/Manifest @@ -0,0 +1,3 @@ +DIST gcc-13-20230826.tar.xz 84285788 BLAKE2B c25be594e322dd7145245c42ae21b98aa9e3e6ae69f1fa313830e40bf2e8fcb8435762f1c9d3f1ca1dbf31653bdc76a658bec708b7850fe40a7c55504ac30618 SHA512 3d47632e90651bd50a881c727c1ef2aa3322b4fc3e082919ae430270901abf8a05a34fe93f8b678c10dc9a0758f93dc3b33ed5947c8743dab453d2b50c063722 +DIST gcc-13.2.0-musl-patches-2.tar.xz 5292 BLAKE2B c057d6574d03c05854edaa9f3fd40e9149662b04f3ac7a7db3eb078d73a7b535726d1bf52e5b12736dedb2f9898ad731f2e48a6421fcfbf7b90f929dee072fcb SHA512 a691da0c87c443a5e9d23731f4005f27871c5b12bc9102873ffa24d374aa7b9fbd187c4f5635d23fa9ffb17e351e76173c2d3fdf40646e355c4cb314b538de69 +DIST gcc-13.2.0-patches-7.tar.xz 37064 BLAKE2B 4a8700a8d44bfaa84926f8bfd0da4c5b0c0377f47fc0679456e909f7c9029b9cf1b72c0ba0bc505d9035d5c38e27f7e5b029727eaf2bc7aca417a6be966b2f43 SHA512 f440c97e6782ecb8581d41608e31a648ac426e2d870bc1d171da7794cdeff2fd0546cae0c7214e72fd3a00ead8a5c66f3f633b670b74553a2f3a40378b51f20c diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch new file mode 100644 index 0000000..e4abe01 --- /dev/null +++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch @@ -0,0 +1,19 @@ +Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384 +for now to fix cross fixincludes builds. + +https://bugs.gentoo.org/905118 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h + # Default native SYSTEM_HEADER_DIR, to be overridden by targets. + NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@ + # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. +-ifeq (@includedir@,$(prefix)/include) +- CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ +-else +- CROSS_SYSTEM_HEADER_DIR = @includedir@ +-endif ++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. + # Purge it of unnecessary internal relative paths diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch b/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch new file mode 100644 index 0000000..5d57473 --- /dev/null +++ b/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch @@ -0,0 +1,105 @@ +https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=af6cfd7b663909688c6ca55b6e9f859cdde4310f +https://gcc.gnu.org/PR110926 + +From af6cfd7b663909688c6ca55b6e9f859cdde4310f Mon Sep 17 00:00:00 2001 +From: liuhongt +Date: Mon, 7 Aug 2023 11:10:52 +0800 +Subject: [PATCH] Fix ICE in rtl check when bootstrap. +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c: In function âmatmul_i1_avx512fâ: +/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c:1781:1: internal compiler error: RTL check: expected elt 0 type 'i' or 'n', have 'w' (rtx const_int) in vpternlog_redundant_operand_mask, at config/i386/i386.cc:19460 + 1781 | } + | ^ +0x5559de26dc2d rtl_check_failed_type2(rtx_def const*, int, int, int, char const*, int, char const*) + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/rtl.cc:761 +0x5559de340bfe vpternlog_redundant_operand_mask(rtx_def**) + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/i386.cc:19460 +0x5559dfec67a6 split_44 + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:12730 +0x5559dfec67a6 split_63 + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:28428 +0x5559deb8a682 try_split(rtx_def*, rtx_insn*, int) + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3800 +0x5559deb8adf2 try_split(rtx_def*, rtx_insn*, int) + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3972 +0x5559def69194 split_insn + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3385 +0x5559def70c57 split_all_insns() + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3489 +0x5559def70d0c execute + /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:4413 + +Use INTVAL (imm_op) instead of XINT (imm_op, 0). + +gcc/ChangeLog: + + PR target/110926 + * config/i386/i386-protos.h + (vpternlog_redundant_operand_mask): Adjust parameter type. + * config/i386/i386.cc (vpternlog_redundant_operand_mask): Use + INTVAL instead of XINT, also adjust parameter type from rtx* + to rtx since the function only needs operands[4] in vpternlog + pattern. + (substitute_vpternlog_operands): Pass operands[4] instead of + operands to vpternlog_redundant_operand_mask. + * config/i386/sse.md: Ditto. +--- a/gcc/config/i386/i386-protos.h ++++ b/gcc/config/i386/i386-protos.h +@@ -70,7 +70,7 @@ extern machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx); + extern int avx_vpermilp_parallel (rtx par, machine_mode mode); + extern int avx_vperm2f128_parallel (rtx par, machine_mode mode); + +-extern int vpternlog_redundant_operand_mask (rtx[]); ++extern int vpternlog_redundant_operand_mask (rtx); + extern void substitute_vpternlog_operands (rtx[]); + + extern bool ix86_expand_strlen (rtx, rtx, rtx, rtx); +--- a/gcc/config/i386/i386.cc ++++ b/gcc/config/i386/i386.cc +@@ -19454,10 +19454,10 @@ avx_vperm2f128_parallel (rtx par, machine_mode mode) + /* Return a mask of VPTERNLOG operands that do not affect output. */ + + int +-vpternlog_redundant_operand_mask (rtx *operands) ++vpternlog_redundant_operand_mask (rtx pternlog_imm) + { + int mask = 0; +- int imm8 = XINT (operands[4], 0); ++ int imm8 = INTVAL (pternlog_imm); + + if (((imm8 >> 4) & 0x0F) == (imm8 & 0x0F)) + mask |= 1; +@@ -19475,7 +19475,7 @@ vpternlog_redundant_operand_mask (rtx *operands) + void + substitute_vpternlog_operands (rtx *operands) + { +- int mask = vpternlog_redundant_operand_mask (operands); ++ int mask = vpternlog_redundant_operand_mask (operands[4]); + + if (mask & 1) /* The first operand is redundant. */ + operands[1] = operands[2]; +--- a/gcc/config/i386/sse.md ++++ b/gcc/config/i386/sse.md +@@ -12751,7 +12751,7 @@ + (match_operand:V 3 "memory_operand") + (match_operand:SI 4 "const_0_to_255_operand")] + UNSPEC_VTERNLOG))] +- "!reload_completed && vpternlog_redundant_operand_mask (operands) == 3" ++ "!reload_completed && vpternlog_redundant_operand_mask (operands[4]) == 3" + [(set (match_dup 0) + (match_dup 3)) + (set (match_dup 0) +@@ -12772,7 +12772,7 @@ + (match_operand:V 3 "nonimmediate_operand") + (match_operand:SI 4 "const_0_to_255_operand")] + UNSPEC_VTERNLOG))] +- "!reload_completed && vpternlog_redundant_operand_mask (operands) != 0" ++ "!reload_completed && vpternlog_redundant_operand_mask (operands[4]) != 0" + [(set (match_dup 0) + (unspec:V + [(match_dup 1) +-- +2.39.3 diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch new file mode 100644 index 0000000..d1b1b03 --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-LANG.patch @@ -0,0 +1,64 @@ +The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in +option parsing, it may break. + +http://bugs.gentoo.org/103483 + +--- configure ++++ configure +@@ -54,6 +54,19 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ unset $as_var ++ fi ++done ++ + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= +@@ -452,16 +463,6 @@ + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. +@@ -1850,6 +1850,19 @@ + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then ++ eval \$as_var=C; export \$as_var ++ else ++ unset \$as_var ++ fi ++done ++ + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch new file mode 100644 index 0000000..99e9099 --- /dev/null +++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch @@ -0,0 +1,16 @@ +Chances are quite good that the installed makeinfo is sufficient. +So ignore false positives where the makeinfo installed is so new +that it violates the cheesy version grep. + +http://bugs.gentoo.org/198182 + +--- a/configure ++++ b/configure +@@ -3573,6 +3573,6 @@ + : + else +- MAKEINFO="$MISSING makeinfo" ++ : + fi + ;; + diff --git a/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild new file mode 100644 index 0000000..b4f76ef --- /dev/null +++ b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2023 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" + +if [[ ${PV} == *.9999 ]] ; then + MY_PV_2=$(ver_cut 2) + MY_PV_3=1 + if [[ ${MY_PV_2} == 0 ]] ; then + MY_PV_2=0 + MY_PV_3=0 + else + MY_PV_2=$((${MY_PV_2} - 1)) + fi + + # e.g. 12.2.9999 -> 12.1.1 + TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3} +elif [[ -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="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + :; +fi + +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="elibc_glibc? ( sys-libs/glibc[cet(-)?] )" + DEPEND="${RDEPEND}" + BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]" +fi + +src_prepare() { + local p upstreamed_patches=( + # add them here + ) + for p in "${upstreamed_patches[@]}"; do + rm -v "${WORKDIR}/patch/${p}" || die + done + + toolchain_src_prepare + + eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch + eapply_user +} diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml new file mode 100644 index 0000000..9147176 --- /dev/null +++ b/sys-devel/gcc/metadata.xml @@ -0,0 +1,113 @@ + + + + + toolchain@gentoo.org + Gentoo Toolchain Project + + + Build the ADA language (GNAT) frontend + + Enable support for Intel Control Flow Enforcement Technology (CET). + + Only effective on amd64/x86. + + Only provides benefits on newer CPUs. For Intel, the CPU + must be at least as new as Tiger Lake. For AMD, it must be + at least as new as Zen 3. This is harmless on older CPUs, + but provides no benefit either. + + When combined with USE=hardened, GCC will set -fcf-protection + by default when building software. The effect is minimal + on systems which do not support it, other than a possible + small increase in codesize for the NOPs. The generated + code is therefore compatible with i686 at the earliest. + + Enable support for the D programming language + + Enables GCC's 'checking' facility via --enable-checking=yes,extra,rtl. + + This adds checks to various compiler passes for integrity and input + validation. This can help catch possible miscompilations early as + well as latent bugs which could become real problems in future, but + at the cost of slower compile times when using GCC. + + Unrelated to backtraces. + + + Build packages with stack clash protection on by default as + a hardening measure. + + This enables -fstack-clash-protection by default which protects against + large memory allocations allowing stack smashing. + + May cause slightly increased codesize, but modern compilers + have been adapted to optimize well for this case, as + this mitigation is now quite common. + + See https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gcc-part-3 + and https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt. + + + Request full relocation on start from ld.so by default. + + This sets the -z,now (BIND_NOW) flag by default on all linker invocations. By + resolving all dynamic symbols at application startup, parts of the program + can be made read-only as a hardening measure. + + This is closely related to RELRO which is also separately + enabled by default. + + In some applications with many unresolved symbols (heavily plugin based, + for example), startup time may be impacted. + + Enable fixed-point arithmetic support for MIPS targets in gcc (Warning: significantly increases compile time!) + Build the GCC Go language frontend. + Add support for the framework for loop optimizations based on a polyhedral intermediate representation + Use accelerated 128-bit IEEE long double ABI (ppc64le only) + Enable libgccjit so other applications can embed gcc for Just-In-Time compilation. + Build SSP support into a dedicated library rather than use the code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES) + + Build using Link Time Optimizations (LTO). + + Note that GCC is always built with support for building + other programs with LTO. This USE flag is for whether + GCC itself is built and optimized with LTO. + + Build the GCC Modula-2 language frontend. + Enable support for Native POSIX Threads Library, the new threading module (requires linux-2.6 or better usually) + Build support for the Objective C code language + Build support for the Objective C++ language + Build support for the Objective C code language Garbage Collector + + Build GCC using Profile Guided Optimization (PGO). + + GCC will build itself and then analyze the just-built + binary and then rebuild itself using the data obtained + from analysis of codepaths taken. + + It does not affect whether GCC itself supports PGO + when building other software. + + This substantially increases the build time needed for + building GCC itself. + + + Build support for various sanitizer functions (ASAN/TSAN/etc...) + to find runtime problems in applications. + + Build packages with stack smashing protection on by default + enable systemtap static probe points + + Build support for virtual table verification (a C++ hardening feature). + + This does not control whether GCC defaults to using VTV> + + Note that actually using VTV breaks ABI and hence the whole + system must be built with -fvtable-verify. + + + + cpe:/a:gnu:gcc + + -- cgit v1.2.3-65-gdbad