gcc 13.1.0: don't enable default ssp or pie and remove libssp_nonshared.patch

This commit is contained in:
Paul Dersey 2023-07-12 20:36:32 -04:00
parent 46d80b8605
commit 184535e2df
4 changed files with 2 additions and 47 deletions

View file

@ -84,8 +84,6 @@ src_configure() {
--host=i386-unknown-linux-musl \
--enable-bootstrap \
--enable-static \
--enable-default-pie \
--enable-default-ssp \
--disable-plugins \
--disable-libssp \
--disable-libsanitizer \

View file

@ -1,35 +0,0 @@
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
SPDX-FileCopyrightText: 2020 Timo Teräs <timo.teras@iki.fi>
SPDX-License-Identifier: GPL-3.0-or-later
The original motivation from this patch from Alpine Linux:
Subject: [PATCH] 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.
Which matches precisely the problem when compiling GCC with --enable-bootstrap
in live-bootstrap.
---
gcc/gcc.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git gcc/gcc.cc gcc/gcc.cc
index cc99d0b7aa1..c60a75371f8 100644
--- gcc/gcc.cc
+++ gcc/gcc.cc
@@ -1004,8 +1004,7 @@ proper position among the other output files. */
#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" \

View file

@ -14,19 +14,11 @@ src_configure() {
src_compile() {
make "${MAKEJOBS}" CROSS_COMPILE=
# Provide libssp_nonshared.a to avoid GCC's messy libssp
# (Taken from Alpine Linux)
gcc -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
ar r libssp_nonshared.a __stack_chk_fail_local.o
}
src_install() {
default
# Install libssp_nonshared.a
install -m 644 libssp_nonshared.a "${DESTDIR}${PREFIX}/lib/"
# Make dynamic linker symlink relative in ${PREFIX}/lib
rm "${DESTDIR}/lib/ld-musl-i386.so.1"
rmdir "${DESTDIR}/lib"