aboutsummaryrefslogtreecommitdiff
path: root/testing/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'testing/gcc')
-rwxr-xr-xtesting/gcc/build78
-rw-r--r--testing/gcc/checksums8
-rw-r--r--testing/gcc/depends4
-rwxr-xr-xtesting/gcc/files/c992
-rw-r--r--testing/gcc/meta3
-rw-r--r--testing/gcc/patches/musl-libssp.patch20
-rw-r--r--testing/gcc/patches/musl-sched_h-calloc-poison.patch26
-rw-r--r--testing/gcc/sources7
-rw-r--r--testing/gcc/version1
9 files changed, 149 insertions, 0 deletions
diff --git a/testing/gcc/build b/testing/gcc/build
new file mode 100755
index 00000000..e4b826ab
--- /dev/null
+++ b/testing/gcc/build
@@ -0,0 +1,78 @@
+#!/bin/sh -e
+
+sys_arch=${3:-$(uname -m)}
+
+# Make sure gmp is built with generic options.
+cp gcc/gmp/configfsf.guess gcc/gmp/config.guess
+cp gcc/gmp/configfsf.sub gcc/gmp/config.sub
+
+if [ "${sys_arch#i*86}" ]; then
+ # Do not create lib64 directories
+ clsed '/m64=/s/lib64/lib/' gcc/gcc/config/i386/t-linux64
+ clsed 's/lib64/lib/' gcc/gcc/config/i386/linux64.h
+else
+ # Apply libssp patch for i686.
+ patch -d gcc -p1 < musl-libssp.patch
+fi
+patch -d gcc -p1 < musl-sched_h-calloc-poison.patch
+
+case "$sys_arch" in
+ i*86) archopts="--build=i686-pc-linux-musl \
+ --disable-libssp" ;;
+ x86_64) archopts="--build=x86_64-pc-linux-musl"
+esac
+
+# Build must happen outside of gcc source.
+mkdir -p gcc-build
+cd gcc-build
+
+export libat_cv_have_ifunc=no
+
+../gcc/configure \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-symvers \
+ --disable-libmpx \
+ --disable-libmudflap \
+ --disable-libsanitizer \
+ --disable-werror \
+ --disable-fixed-point \
+ --disable-libstdcxx-pch \
+ --disable-nls \
+ --without-included-gettext \
+ --enable-checking=release \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --with-system-zlib \
+ --enable-__cxa_atexit \
+ --enable-default-pie \
+ --enable-default-ssp \
+ --enable-shared \
+ --enable-threads \
+ --enable-tls \
+ --enable-languages=c,c++ \
+ $archopts \
+ --disable-bootstrap
+
+make
+make DESTDIR="$1" install
+
+# Save 35MB.
+find "$1" -name libgtkpeer.a -exec rm -f {} +
+find "$1" -name libgjsmalsa.a -exec rm -f {} +
+find "$1" -name libgij.a -exec rm -f {} +
+
+# Some legacy programs will expect cc
+ln -s gcc "$1/usr/bin/cc"
+
+# POSIX compliance.
+clinst -Dm755 ../c99 "$1/usr/bin/c99"
+
+# Symlink for LTO.
+{
+ mkdir -p "$1/usr/lib/bfd-plugins"
+
+ ln -s "/usr/libexec/gcc/$sys_arch-pc-linux-musl/$2/liblto_plugin.so" \
+ "$1/usr/lib/bfd-plugins/liblto_plugin.so"
+}
+
diff --git a/testing/gcc/checksums b/testing/gcc/checksums
new file mode 100644
index 00000000..a2961d42
--- /dev/null
+++ b/testing/gcc/checksums
@@ -0,0 +1,8 @@
+%BLAKE3
+f4031aa70a30b0d14fb8b0f331860ba4faf484494208ad7a7a9399becb9a85a2 gcc-12.1.0.tar.xz
+52cecfbbe286820d1f8bc118769008acb6451bd074fe6dea9e868d54b2ada855 gmp-6.2.1.tar.xz
+956f9b16d0377b777e21b07d27962ec1153236ef2e94039ec1ad375859c01fc9 mpfr-4.1.0.tar.xz
+f967a250c85296a88bf6a2471b74558d89a59fe548e119f6d74fccb7cb73b13e mpc-1.2.1.tar.gz
+0930e07dc2c5bf1172f3fd003a1be7abc3c0c420ce5bd76bc2e514c63800adcb c99
+30c25e440a4ac72bf7dc50e564b94a8c4ef43e4b2030c12d3042a78fb3cbc825 musl-libssp.patch
+495a5f94c38d940dc174e8d9cbd2bc4a9399062e579a0de0afddbec0f0c2f39c musl-sched_h-calloc-poison.patch
diff --git a/testing/gcc/depends b/testing/gcc/depends
new file mode 100644
index 00000000..3eb45901
--- /dev/null
+++ b/testing/gcc/depends
@@ -0,0 +1,4 @@
+binutils
+byacc make
+flex make
+zlib
diff --git a/testing/gcc/files/c99 b/testing/gcc/files/c99
new file mode 100755
index 00000000..692f0924
--- /dev/null
+++ b/testing/gcc/files/c99
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec cc -std=c99 "$@"
diff --git a/testing/gcc/meta b/testing/gcc/meta
new file mode 100644
index 00000000..fe87fa76
--- /dev/null
+++ b/testing/gcc/meta
@@ -0,0 +1,3 @@
+description: GNU Compiler Collection
+license: GPL-3.0-or-later, LGPL-2.1-or-later
+maintainer: Cem Keylan <cem@carbslinux.org>
diff --git a/testing/gcc/patches/musl-libssp.patch b/testing/gcc/patches/musl-libssp.patch
new file mode 100644
index 00000000..fe5c6143
--- /dev/null
+++ b/testing/gcc/patches/musl-libssp.patch
@@ -0,0 +1,20 @@
+Author: Timo Teräs <timo.teras@iki.fi>
+
+Alpine musl package provides libssp_nonshared.a. We link to it unconditionally,
+as otherwise we get link failures if some objects are -fstack-protector built
+and final link happens with -fno-stack-protector. This seems to be the common
+case when bootstrapping gcc, the piepatches do not seem to fully fix the
+crosstoolchain and bootstrap sequence wrt. stack-protector flag usage.
+
+--- gcc-6.1.0/gcc/gcc.c.orig
++++ gcc-6.1.0/gcc/gcc.c
+@@ -870,8 +870,7 @@
+
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+- "|fstack-protector-strong|fstack-protector-explicit:}"
++#define LINK_SSP_SPEC "-lssp_nonshared"
+ #else
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
diff --git a/testing/gcc/patches/musl-sched_h-calloc-poison.patch b/testing/gcc/patches/musl-sched_h-calloc-poison.patch
new file mode 100644
index 00000000..e5621106
--- /dev/null
+++ b/testing/gcc/patches/musl-sched_h-calloc-poison.patch
@@ -0,0 +1,26 @@
+diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
+index 12ab5a5..a2762e7 100644
+--- a/libcc1/libcc1plugin.cc
++++ b/libcc1/libcc1plugin.cc
+@@ -31,6 +31,8 @@
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+
++#include <pthread.h>
++
+ #include "gcc-plugin.h"
+ #include "system.h"
+ #include "coretypes.h"
+diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
+index 83dab7f..d84fa64 100644
+--- a/libcc1/libcp1plugin.cc
++++ b/libcc1/libcp1plugin.cc
+@@ -32,6 +32,8 @@
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+
++#include <pthread.h>
++
+ #include "gcc-plugin.h"
+ #include "system.h"
+ #include "coretypes.h"
diff --git a/testing/gcc/sources b/testing/gcc/sources
new file mode 100644
index 00000000..01cd92b8
--- /dev/null
+++ b/testing/gcc/sources
@@ -0,0 +1,7 @@
+https://gcc.gnu.org/pub/gcc/releases/gcc-12.1.0/gcc-12.1.0.tar.xz gcc
+https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz gcc/gmp
+https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.xz gcc/mpfr
+https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz gcc/mpc
+files/c99
+patches/musl-libssp.patch
+patches/musl-sched_h-calloc-poison.patch
diff --git a/testing/gcc/version b/testing/gcc/version
new file mode 100644
index 00000000..d3f2d92e
--- /dev/null
+++ b/testing/gcc/version
@@ -0,0 +1 @@
+12.1.0 1