gcc: remove i686 patch for stack_chk_fail_local

This patch was introduced with gcc 7.2.0 to circumvent problems
with strong stack protector enabled for gcc.

With the current version it is not just obsolete but outright
wrong and causes "strange" issues with builds failing for
no obvious reason.

One example is the mruby package which failed to build and
now, after the bad patch is removed, works out of the box.

Add a new patch libssp-musl.patch and with the same revbump
add two patches for mips32 header file sgidefs.h location
and soft-float for mips-musl and mipsel-musl.

[ci skip]
This commit is contained in:
Jürgen Buchmüller 2020-06-06 16:21:09 +02:00 committed by q66
parent 6d7a50cc55
commit e89ea5e453
5 changed files with 45 additions and 26 deletions

View file

@ -0,0 +1,13 @@
--- gcc-6.1.0/gcc/gcc.c.orig
+++ gcc-6.1.0/gcc/gcc.c
@@ -876,9 +876,8 @@
#endif
#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

@ -0,0 +1,11 @@
--- libffi/src/mips/ffitarget.h 2014-11-08 13:47:24.000000000 +0100
+++ libffi/src/mips/ffitarget.h 2017-11-09 16:51:11.866848444 +0100
@@ -42,7 +42,7 @@
#define _MIPS_SIM_NABI32 2
#define _MIPS_SIM_ABI64 3
#elif !defined(__OpenBSD__)
-# include <sgidefs.h>
+# include <asm/sgidefs.h>
#endif
# ifndef _ABIN32

View file

@ -0,0 +1,18 @@
--- libffi/src/mips/o32.S 2020-03-12 12:07:23.000000000 +0100
+++ libffi/src/mips/o32.S 2020-05-14 20:52:45.701809054 +0200
@@ -278,6 +278,7 @@
li $9, FFI_TYPE_VOID
beq $8, $9, closure_done
+#ifndef __mips_soft_float
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
@@ -289,6 +290,7 @@
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
1:
+#endif
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)

View file

@ -1,23 +0,0 @@
--- gcc/targhooks.c 2017-02-07 12:29:06.644837000 +0100
+++ gcc/targhooks.c 2017-10-29 17:08:58.318032821 +0100
@@ -856,8 +856,8 @@
if (t == NULL_TREE)
{
t = build_function_type_list (void_type_node, NULL_TREE);
- t = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL,
- get_identifier ("__stack_chk_fail_local"), t);
+ t = build_decl (UNKNOWN_LOCATION,
+ FUNCTION_DECL, get_identifier ("__stack_chk_fail"), t);
TREE_STATIC (t) = 1;
TREE_PUBLIC (t) = 1;
DECL_EXTERNAL (t) = 1;
@@ -866,8 +866,8 @@
TREE_NOTHROW (t) = 1;
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
+ DECL_VISIBILITY (t) = VISIBILITY_DEFAULT;
DECL_VISIBILITY_SPECIFIED (t) = 1;
- DECL_VISIBILITY (t) = VISIBILITY_HIDDEN;
stack_chk_fail_decl = t;
}

View file

@ -8,7 +8,7 @@ _isl_version=0.21
pkgname=gcc
version=${_minorver}.0
revision=5
revision=6
short_desc="GNU Compiler Collection"
maintainer="Enno Boland <gottox@voidlinux.org>"
homepage="http://gcc.gnu.org"
@ -36,7 +36,7 @@ _have_gccgo=yes
# MIPS does not have libucontext yet
# no support for ppcle in gccgo (missing GOARCH and stuff)
case "$XBPS_TARGET_MACHINE" in
mips*-musl|ppcle*) _have_gccgo=no ;;
i686-musl|mips*-musl|ppcle*) _have_gccgo=no ;;
esac
if [ "$CHROOT_READY" ]; then
@ -171,6 +171,7 @@ pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
patch -p1 -i ${FILESDIR}/libgnarl-musl.patch
patch -p1 -i ${FILESDIR}/libssp-musl.patch
patch -p0 -i ${FILESDIR}/gccgo-musl.patch
;;
esac
@ -320,7 +321,6 @@ do_configure() {
CONFIG_SHELL=/bin/bash \
${wrksrc}/configure ${_args}
fi
}
do_build() {
if [ -z "$CHROOT_READY" ]; then