commit:     a33f8322ffd4b0826e3e3024ad67860335cdfac0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 23 23:03:17 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 23:03:17 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a33f8322

14.0.0: add musl patches too

Clone of 13.1.0.

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

 14.0.0/musl/25_all_multilib_pure64.patch        | 83 +++++++++++++++++++++++++
 14.0.0/musl/50_all_cpu_indicator.patch          | 37 +++++++++++
 14.0.0/musl/50_all_libssp_unconditionally.patch | 24 +++++++
 14.0.0/musl/50_all_posix_memalign.patch         | 28 +++++++++
 14.0.0/musl/README.history                      |  6 ++
 5 files changed, 178 insertions(+)

diff --git a/14.0.0/musl/25_all_multilib_pure64.patch 
b/14.0.0/musl/25_all_multilib_pure64.patch
new file mode 100644
index 0000000..d55c04c
--- /dev/null
+++ b/14.0.0/musl/25_all_multilib_pure64.patch
@@ -0,0 +1,83 @@
+https://bugs.gentoo.org/675954
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90077
+
+--- a/gcc/config/aarch64/t-aarch64-linux
++++ b/gcc/config/aarch64/t-aarch64-linux
+@@ -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)
+--- a/gcc/config/i386/t-linux64
++++ b/gcc/config/i386/t-linux64
+@@ -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
+--- a/gcc/config/rs6000/t-linux
++++ b/gcc/config/rs6000/t-linux
+@@ -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
+ 
+--- a/gcc/config/rs6000/t-linux64
++++ b/gcc/config/rs6000/t-linux64
+@@ -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) $<
+--- a/gcc/config/rs6000/t-linux64bele
++++ b/gcc/config/rs6000/t-linux64bele
+@@ -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}
+--- a/gcc/config/rs6000/t-linux64lebe
++++ b/gcc/config/rs6000/t-linux64lebe
+@@ -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/14.0.0/musl/50_all_cpu_indicator.patch 
b/14.0.0/musl/50_all_cpu_indicator.patch
new file mode 100644
index 0000000..52e8b92
--- /dev/null
+++ b/14.0.0/musl/50_all_cpu_indicator.patch
@@ -0,0 +1,37 @@
+https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612648.html
+
+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"
+
+--- a/gcc/config/i386/i386-expand.cc
++++ b/gcc/config/i386/i386-expand.cc
+@@ -12338,10 +12338,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);
+       }
+
+--- 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

diff --git a/14.0.0/musl/50_all_libssp_unconditionally.patch 
b/14.0.0/musl/50_all_libssp_unconditionally.patch
new file mode 100644
index 0000000..a3b5984
--- /dev/null
+++ b/14.0.0/musl/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.)
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -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" \

diff --git a/14.0.0/musl/50_all_posix_memalign.patch 
b/14.0.0/musl/50_all_posix_memalign.patch
new file mode 100644
index 0000000..dd75a93
--- /dev/null
+++ b/14.0.0/musl/50_all_posix_memalign.patch
@@ -0,0 +1,28 @@
+--- a/gcc/config/i386/pmm_malloc.h
++++ b/gcc/config/i386/pmm_malloc.h
+@@ -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/14.0.0/musl/README.history b/14.0.0/musl/README.history
new file mode 100644
index 0000000..05b8810
--- /dev/null
+++ b/14.0.0/musl/README.history
@@ -0,0 +1,6 @@
+1      23 Apr 2023
+
+       + 25_all_multilib_pure64.patch
+       + 50_all_cpu_indicator.patch
+       + 50_all_libssp_unconditionally.patch
+       + 50_all_posix_memalign.patch

Reply via email to