Move libssp into musl out of GCC

The motivations for this are complicated, but on musl systems, musl
will use its own libssp implementation, so GCC's libssp is not required.

Not to mention that GCC's libssp implementation is questionable at best.

This is the approach taken by the two major musl distributions - Alpine
Linux and Void Linux.
This commit is contained in:
fosslinux 2023-04-17 22:18:45 +10:00
parent 906b6b8f19
commit 8ae911162a
4 changed files with 20 additions and 3 deletions

View file

@ -95,5 +95,6 @@ src_configure() {
--disable-sjlj-exceptions \
--disable-multilib \
--enable-threads=posix \
--disable-libsanitizer
--disable-libsanitizer \
--disable-libssp
}

View file

@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2020 Timo Teräs <timo.teras@iki.fi>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
extern void __stack_chk_fail(void);
void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { __stack_chk_fail(); }

View file

@ -14,11 +14,19 @@ 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"