From e89ea5e453652754d76e5877eead19ae7e94cf8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sat, 6 Jun 2020 16:21:09 +0200 Subject: [PATCH] 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] --- srcpkgs/gcc/files/libssp-musl.patch | 13 +++++++++++ srcpkgs/gcc/patches/mips-sgidefs_h.patch | 11 +++++++++ srcpkgs/gcc/patches/mips-soft-float.patch | 18 +++++++++++++++ .../gcc/patches/no-stack_chk_fail_local.patch | 23 ------------------- srcpkgs/gcc/template | 6 ++--- 5 files changed, 45 insertions(+), 26 deletions(-) create mode 100644 srcpkgs/gcc/files/libssp-musl.patch create mode 100644 srcpkgs/gcc/patches/mips-sgidefs_h.patch create mode 100644 srcpkgs/gcc/patches/mips-soft-float.patch delete mode 100644 srcpkgs/gcc/patches/no-stack_chk_fail_local.patch diff --git a/srcpkgs/gcc/files/libssp-musl.patch b/srcpkgs/gcc/files/libssp-musl.patch new file mode 100644 index 00000000000..9729a49f09c --- /dev/null +++ b/srcpkgs/gcc/files/libssp-musl.patch @@ -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" \ diff --git a/srcpkgs/gcc/patches/mips-sgidefs_h.patch b/srcpkgs/gcc/patches/mips-sgidefs_h.patch new file mode 100644 index 00000000000..e5fdbf9f96f --- /dev/null +++ b/srcpkgs/gcc/patches/mips-sgidefs_h.patch @@ -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 ++# include + #endif + + # ifndef _ABIN32 diff --git a/srcpkgs/gcc/patches/mips-soft-float.patch b/srcpkgs/gcc/patches/mips-soft-float.patch new file mode 100644 index 00000000000..4db0e2fb07a --- /dev/null +++ b/srcpkgs/gcc/patches/mips-soft-float.patch @@ -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) + diff --git a/srcpkgs/gcc/patches/no-stack_chk_fail_local.patch b/srcpkgs/gcc/patches/no-stack_chk_fail_local.patch deleted file mode 100644 index a588880defd..00000000000 --- a/srcpkgs/gcc/patches/no-stack_chk_fail_local.patch +++ /dev/null @@ -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; - } diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template index 74f4cc671ee..ae3947b47bf 100644 --- a/srcpkgs/gcc/template +++ b/srcpkgs/gcc/template @@ -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 " 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