commit:     43a0d33ef329c7d9a8e3607a03d472a98f9ddf82
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  8 04:05:15 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan  8 04:05:15 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=43a0d33e

10.4.0: add musl patches (copied from 10.3.0)

Just for consistency here.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 10.4.0/musl/25_all_multilib_pure64.patch           | 86 ++++++++++++++++++++++
 10.4.0/musl/50_all_cpu_indicator.patch             | 46 ++++++++++++
 10.4.0/musl/50_all_posix_memalign.patch            | 29 ++++++++
 .../nocross/50_all_libssp_unconditionally.patch    | 24 ++++++
 4 files changed, 185 insertions(+)

diff --git a/10.4.0/musl/25_all_multilib_pure64.patch 
b/10.4.0/musl/25_all_multilib_pure64.patch
new file mode 100644
index 0000000..19fd5c9
--- /dev/null
+++ b/10.4.0/musl/25_all_multilib_pure64.patch
@@ -0,0 +1,86 @@
+diff -Naur gcc-9.3.0.orig/gcc/config/aarch64/t-aarch64-linux 
gcc-9.3.0/gcc/config/aarch64/t-aarch64-linux
+--- gcc-9.3.0.orig/gcc/config/aarch64/t-aarch64-linux  2020-10-05 
02:59:12.767988285 -0700
++++ gcc-9.3.0/gcc/config/aarch64/t-aarch64-linux       2020-10-05 
03:03:32.310816444 -0700
+@@ -22,7 +22,7 @@
+ LIB1ASMFUNCS = _aarch64_sync_cache_range
+ 
+ AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
++MULTILIB_OSDIRNAMES = mabi.lp64=../lib
+ MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+ 
+ MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call 
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+diff -Naur gcc-9.3.0.orig/gcc/config/i386/t-linux64 
gcc-9.3.0/gcc/config/i386/t-linux64
+--- gcc-9.3.0.orig/gcc/config/i386/t-linux64   2020-10-05 02:59:12.757989347 
-0700
++++ gcc-9.3.0/gcc/config/i386/t-linux64        2020-10-05 03:24:58.878825272 
-0700
+@@ -33,6 +33,6 @@
+ comma=,
+ MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo 
$(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call 
if_multiarch,:i386-linux-gnu)
+-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
++MULTILIB_OSDIRNAMES+= mx32=../libx32
+diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux 
gcc-9.3.0/gcc/config/rs6000/t-linux
+--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux   2020-10-05 02:59:12.767988285 
-0700
++++ gcc-9.3.0/gcc/config/rs6000/t-linux        2020-10-05 03:03:32.310816444 
-0700
+@@ -2,7 +2,8 @@
+ # or soft-float.
+ ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring 
soft,$(with_float)))
+ ifneq (,$(findstring powerpc64,$(target)))
+-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ else
+ MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
+ endif
+@@ -10,7 +11,8 @@
+ MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
+ endif
+ ifneq (,$(findstring powerpc64le,$(target)))
+-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ endif
+ endif
+ 
+diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64 
gcc-9.3.0/gcc/config/rs6000/t-linux64
+--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64 2020-10-05 02:59:12.767988285 
-0700
++++ gcc-9.3.0/gcc/config/rs6000/t-linux64      2020-10-05 03:03:32.310816444 
-0700
+@@ -28,8 +28,8 @@
+ MULTILIB_OPTIONS    := m64/m32
+ MULTILIB_DIRNAMES   := 64 32
+ MULTILIB_EXTRA_OPTS := 
+-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo 
$(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call 
if_multiarch,:powerpc-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ 
+ rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
+       $(COMPILE) $<
+diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64bele 
gcc-9.3.0/gcc/config/rs6000/t-linux64bele
+--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64bele     2020-10-05 
02:59:12.767988285 -0700
++++ gcc-9.3.0/gcc/config/rs6000/t-linux64bele  2020-10-05 03:03:32.310816444 
-0700
+@@ -2,6 +2,6 @@
+ 
+ MULTILIB_OPTIONS    += mlittle
+ MULTILIB_DIRNAMES   += le
+-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst 
lible64,lib64le,$(subst lib,lible,$(subst 
-linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 
64,$(target)),m64,m32).,,$(filter $(if $(findstring 
64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
+diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64lebe 
gcc-9.3.0/gcc/config/rs6000/t-linux64lebe
+--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64lebe     2020-10-05 
02:59:12.777987222 -0700
++++ gcc-9.3.0/gcc/config/rs6000/t-linux64lebe  2020-10-05 03:03:32.310816444 
-0700
+@@ -2,6 +2,6 @@
+ 
+ MULTILIB_OPTIONS    += mbig
+ MULTILIB_DIRNAMES   += be
+-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst 
libbe64,lib64be,$(subst lib,libbe,$(subst 
le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 
64,$(target)),m64,m32).,,$(filter $(if $(findstring 
64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}

diff --git a/10.4.0/musl/50_all_cpu_indicator.patch 
b/10.4.0/musl/50_all_cpu_indicator.patch
new file mode 100644
index 0000000..6141a83
--- /dev/null
+++ b/10.4.0/musl/50_all_cpu_indicator.patch
@@ -0,0 +1,46 @@
+From d16a8ceb1c3c8a7ec381090b4c316ff4c55661c0 Mon Sep 17 00:00:00 2001
+From: 
+Date: Thu, 7 May 2020 21:14:11 -0500
+Subject: [PATCH] convert "__cpu_indicator_init" to
+ "__cpu_indicator_init_local"
+
+---
+ gcc/config/i386/i386-expand.c | 4 ++--
+ libgcc/config/i386/cpuinfo.c  | 6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
+index 48f00c5fc..78650b202 100644
+--- a/gcc/config/i386/i386-expand.c
++++ b/gcc/config/i386/i386-expand.c
+@@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx 
subtarget,
+     {
+     case IX86_BUILTIN_CPU_INIT:
+       {
+-      /* Make it call __cpu_indicator_init in libgcc. */
++      /* Make it call __cpu_indicator_init_local in libgcc. */
+       tree call_expr, fndecl, type;
+         type = build_function_type_list (integer_type_node, NULL_TREE); 
+-      fndecl = build_fn_decl ("__cpu_indicator_init", type);
++      fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
+       call_expr = build_call_expr (fndecl, 0); 
+       return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
+       }
+diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
+index 00322c586..f42bbb8af 100644
+--- a/libgcc/config/i386/cpuinfo.c
++++ b/libgcc/config/i386/cpuinfo.c
+@@ -508,7 +508,7 @@ __cpu_indicator_init (void)
+   return 0;
+ }
+ 
+-#if defined SHARED && defined USE_ELF_SYMVER
+-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
+-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
++#ifndef SHARED
++int __cpu_indicator_init_local (void)
++  __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif
+-- 
+2.26.2
+

diff --git a/10.4.0/musl/50_all_posix_memalign.patch 
b/10.4.0/musl/50_all_posix_memalign.patch
new file mode 100644
index 0000000..a288e1d
--- /dev/null
+++ b/10.4.0/musl/50_all_posix_memalign.patch
@@ -0,0 +1,29 @@
+diff -Naur gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h 
gcc-7.1.0/gcc/config/i386/pmm_malloc.h
+--- gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h        2017-01-01 
04:07:43.000000000 -0800
++++ gcc-7.1.0/gcc/config/i386/pmm_malloc.h     2017-05-07 11:35:22.878398460 
-0700
+@@ -27,12 +27,13 @@
+ #include <stdlib.h>
+ 
+ /* We can't depend on <stdlib.h> since the prototype of posix_memalign
+-   may not be visible.  */
++   may not be visible and we can't pollute the namespace either.  */
+ #ifndef __cplusplus
+-extern int posix_memalign (void **, size_t, size_t);
++extern int __gcc_posix_memalign (void **, size_t, size_t)
+ #else
+-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
++extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw ()
+ #endif
++__asm__("posix_memalign");
+ 
+ static __inline void *
+ _mm_malloc (size_t __size, size_t __alignment)
+@@ -42,7 +43,7 @@
+     return malloc (__size);
+   if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
+     __alignment = sizeof (void *);
+-  if (posix_memalign (&__ptr, __alignment, __size) == 0)
++  if (__gcc_posix_memalign (&__ptr, __alignment, __size) == 0)
+     return __ptr;
+   else
+     return NULL;

diff --git a/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch 
b/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch
new file mode 100644
index 0000000..7e4c58a
--- /dev/null
+++ b/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/706210
+https://bugs.gentoo.org/747346
+
+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."
+
+(We do the same in Gentoo.)
+--- 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" \

Reply via email to