commit:     e5b037865b4a7264c27c7fc64466de1012d4b29c
Author:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 13 02:01:35 2021 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Mon Sep 13 02:01:35 2021 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=e5b03786

sys-devel/gcc: use libssp_nonshared.a for ssp

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 sys-devel/gcc/files/gcc-6.1-musl-libssp.patch | 20 ++++++++++++++++++++
 sys-devel/gcc/gcc-10.3.0-r2.ebuild            |  4 ++++
 sys-devel/gcc/gcc-11.1.0-r1.ebuild            |  4 ++++
 sys-devel/gcc/gcc-11.2.0.ebuild               |  4 ++++
 4 files changed, 32 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch 
b/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch
new file mode 100644
index 0000000..fe5c614
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch
@@ -0,0 +1,20 @@
+Author: Timo Teräs <timo.te...@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/sys-devel/gcc/gcc-10.3.0-r2.ebuild 
b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
index 52430b9..7dec59f 100644
--- a/sys-devel/gcc/gcc-10.3.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
@@ -23,5 +23,9 @@ src_prepare() {
                esac
        fi
 
+       if [[ ${CATEGORY} != cross-* ]] ; then
+               eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+       fi
+
        eapply_user
 }

diff --git a/sys-devel/gcc/gcc-11.1.0-r1.ebuild 
b/sys-devel/gcc/gcc-11.1.0-r1.ebuild
index f60c567..5b6db15 100644
--- a/sys-devel/gcc/gcc-11.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-11.1.0-r1.ebuild
@@ -27,5 +27,9 @@ src_prepare() {
                esac
        fi
 
+       if [[ ${CATEGORY} != cross-* ]] ; then
+               eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+       fi
+
        eapply_user
 }

diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
index 3f91080..ccb6c1c 100644
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ b/sys-devel/gcc/gcc-11.2.0.ebuild
@@ -23,5 +23,9 @@ src_prepare() {
                esac
        fi
 
+       if [[ ${CATEGORY} != cross-* ]] ; then
+               eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+       fi
+
        eapply_user
 }
\ No newline at end of file

Reply via email to