Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 10.4.0/musl/nocross/, 10.4.0/musl/
Date: Sat, 08 Jan 2022 04:05:50
Message-Id: 1641614715.43a0d33ef329c7d9a8e3607a03d472a98f9ddf82.sam@gentoo
1 commit: 43a0d33ef329c7d9a8e3607a03d472a98f9ddf82
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 8 04:05:15 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 8 04:05:15 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=43a0d33e
7
8 10.4.0: add musl patches (copied from 10.3.0)
9
10 Just for consistency here.
11
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 10.4.0/musl/25_all_multilib_pure64.patch | 86 ++++++++++++++++++++++
15 10.4.0/musl/50_all_cpu_indicator.patch | 46 ++++++++++++
16 10.4.0/musl/50_all_posix_memalign.patch | 29 ++++++++
17 .../nocross/50_all_libssp_unconditionally.patch | 24 ++++++
18 4 files changed, 185 insertions(+)
19
20 diff --git a/10.4.0/musl/25_all_multilib_pure64.patch b/10.4.0/musl/25_all_multilib_pure64.patch
21 new file mode 100644
22 index 0000000..19fd5c9
23 --- /dev/null
24 +++ b/10.4.0/musl/25_all_multilib_pure64.patch
25 @@ -0,0 +1,86 @@
26 +diff -Naur gcc-9.3.0.orig/gcc/config/aarch64/t-aarch64-linux gcc-9.3.0/gcc/config/aarch64/t-aarch64-linux
27 +--- gcc-9.3.0.orig/gcc/config/aarch64/t-aarch64-linux 2020-10-05 02:59:12.767988285 -0700
28 ++++ gcc-9.3.0/gcc/config/aarch64/t-aarch64-linux 2020-10-05 03:03:32.310816444 -0700
29 +@@ -22,7 +22,7 @@
30 + LIB1ASMFUNCS = _aarch64_sync_cache_range
31 +
32 + AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
33 +-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
34 ++MULTILIB_OSDIRNAMES = mabi.lp64=../lib
35 + MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
36 +
37 + MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
38 +diff -Naur gcc-9.3.0.orig/gcc/config/i386/t-linux64 gcc-9.3.0/gcc/config/i386/t-linux64
39 +--- gcc-9.3.0.orig/gcc/config/i386/t-linux64 2020-10-05 02:59:12.757989347 -0700
40 ++++ gcc-9.3.0/gcc/config/i386/t-linux64 2020-10-05 03:24:58.878825272 -0700
41 +@@ -33,6 +33,6 @@
42 + comma=,
43 + MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
44 + MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
45 +-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
46 +-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
47 +-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
48 ++MULTILIB_OSDIRNAMES = m64=../lib
49 ++MULTILIB_OSDIRNAMES+= m32=../lib32
50 ++MULTILIB_OSDIRNAMES+= mx32=../libx32
51 +diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux gcc-9.3.0/gcc/config/rs6000/t-linux
52 +--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux 2020-10-05 02:59:12.767988285 -0700
53 ++++ gcc-9.3.0/gcc/config/rs6000/t-linux 2020-10-05 03:03:32.310816444 -0700
54 +@@ -2,7 +2,8 @@
55 + # or soft-float.
56 + ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
57 + ifneq (,$(findstring powerpc64,$(target)))
58 +-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
59 ++MULTILIB_OSDIRNAMES := m64=../lib
60 ++MULTILIB_OSDIRNAMES += m32=../lib32
61 + else
62 + MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
63 + endif
64 +@@ -10,7 +11,8 @@
65 + MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
66 + endif
67 + ifneq (,$(findstring powerpc64le,$(target)))
68 +-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
69 ++MULTILIB_OSDIRNAMES := m64=../lib
70 ++MULTILIB_OSDIRNAMES += m32=../lib32
71 + endif
72 + endif
73 +
74 +diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64 gcc-9.3.0/gcc/config/rs6000/t-linux64
75 +--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64 2020-10-05 02:59:12.767988285 -0700
76 ++++ gcc-9.3.0/gcc/config/rs6000/t-linux64 2020-10-05 03:03:32.310816444 -0700
77 +@@ -28,8 +28,8 @@
78 + MULTILIB_OPTIONS := m64/m32
79 + MULTILIB_DIRNAMES := 64 32
80 + MULTILIB_EXTRA_OPTS :=
81 +-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
82 +-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
83 ++MULTILIB_OSDIRNAMES := m64=../lib
84 ++MULTILIB_OSDIRNAMES += m32=../lib32
85 +
86 + rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
87 + $(COMPILE) $<
88 +diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64bele gcc-9.3.0/gcc/config/rs6000/t-linux64bele
89 +--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64bele 2020-10-05 02:59:12.767988285 -0700
90 ++++ gcc-9.3.0/gcc/config/rs6000/t-linux64bele 2020-10-05 03:03:32.310816444 -0700
91 +@@ -2,6 +2,6 @@
92 +
93 + MULTILIB_OPTIONS += mlittle
94 + MULTILIB_DIRNAMES += le
95 +-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
96 +-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
97 ++MULTILIB_OSDIRNAMES = m64=../lib
98 ++MULTILIB_OSDIRNAMES+= m32=../lib32
99 + MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
100 +diff -Naur gcc-9.3.0.orig/gcc/config/rs6000/t-linux64lebe gcc-9.3.0/gcc/config/rs6000/t-linux64lebe
101 +--- gcc-9.3.0.orig/gcc/config/rs6000/t-linux64lebe 2020-10-05 02:59:12.777987222 -0700
102 ++++ gcc-9.3.0/gcc/config/rs6000/t-linux64lebe 2020-10-05 03:03:32.310816444 -0700
103 +@@ -2,6 +2,6 @@
104 +
105 + MULTILIB_OPTIONS += mbig
106 + MULTILIB_DIRNAMES += be
107 +-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
108 +-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
109 ++MULTILIB_OSDIRNAMES := m64=../lib
110 ++MULTILIB_OSDIRNAMES += m32=../lib32
111 + MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
112
113 diff --git a/10.4.0/musl/50_all_cpu_indicator.patch b/10.4.0/musl/50_all_cpu_indicator.patch
114 new file mode 100644
115 index 0000000..6141a83
116 --- /dev/null
117 +++ b/10.4.0/musl/50_all_cpu_indicator.patch
118 @@ -0,0 +1,46 @@
119 +From d16a8ceb1c3c8a7ec381090b4c316ff4c55661c0 Mon Sep 17 00:00:00 2001
120 +From:
121 +Date: Thu, 7 May 2020 21:14:11 -0500
122 +Subject: [PATCH] convert "__cpu_indicator_init" to
123 + "__cpu_indicator_init_local"
124 +
125 +---
126 + gcc/config/i386/i386-expand.c | 4 ++--
127 + libgcc/config/i386/cpuinfo.c | 6 +++---
128 + 2 files changed, 5 insertions(+), 5 deletions(-)
129 +
130 +diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
131 +index 48f00c5fc..78650b202 100644
132 +--- a/gcc/config/i386/i386-expand.c
133 ++++ b/gcc/config/i386/i386-expand.c
134 +@@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
135 + {
136 + case IX86_BUILTIN_CPU_INIT:
137 + {
138 +- /* Make it call __cpu_indicator_init in libgcc. */
139 ++ /* Make it call __cpu_indicator_init_local in libgcc. */
140 + tree call_expr, fndecl, type;
141 + type = build_function_type_list (integer_type_node, NULL_TREE);
142 +- fndecl = build_fn_decl ("__cpu_indicator_init", type);
143 ++ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
144 + call_expr = build_call_expr (fndecl, 0);
145 + return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
146 + }
147 +diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
148 +index 00322c586..f42bbb8af 100644
149 +--- a/libgcc/config/i386/cpuinfo.c
150 ++++ b/libgcc/config/i386/cpuinfo.c
151 +@@ -508,7 +508,7 @@ __cpu_indicator_init (void)
152 + return 0;
153 + }
154 +
155 +-#if defined SHARED && defined USE_ELF_SYMVER
156 +-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
157 +-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
158 ++#ifndef SHARED
159 ++int __cpu_indicator_init_local (void)
160 ++ __attribute__ ((weak, alias ("__cpu_indicator_init")));
161 + #endif
162 +--
163 +2.26.2
164 +
165
166 diff --git a/10.4.0/musl/50_all_posix_memalign.patch b/10.4.0/musl/50_all_posix_memalign.patch
167 new file mode 100644
168 index 0000000..a288e1d
169 --- /dev/null
170 +++ b/10.4.0/musl/50_all_posix_memalign.patch
171 @@ -0,0 +1,29 @@
172 +diff -Naur gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h gcc-7.1.0/gcc/config/i386/pmm_malloc.h
173 +--- gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h 2017-01-01 04:07:43.000000000 -0800
174 ++++ gcc-7.1.0/gcc/config/i386/pmm_malloc.h 2017-05-07 11:35:22.878398460 -0700
175 +@@ -27,12 +27,13 @@
176 + #include <stdlib.h>
177 +
178 + /* We can't depend on <stdlib.h> since the prototype of posix_memalign
179 +- may not be visible. */
180 ++ may not be visible and we can't pollute the namespace either. */
181 + #ifndef __cplusplus
182 +-extern int posix_memalign (void **, size_t, size_t);
183 ++extern int __gcc_posix_memalign (void **, size_t, size_t)
184 + #else
185 +-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
186 ++extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw ()
187 + #endif
188 ++__asm__("posix_memalign");
189 +
190 + static __inline void *
191 + _mm_malloc (size_t __size, size_t __alignment)
192 +@@ -42,7 +43,7 @@
193 + return malloc (__size);
194 + if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
195 + __alignment = sizeof (void *);
196 +- if (posix_memalign (&__ptr, __alignment, __size) == 0)
197 ++ if (__gcc_posix_memalign (&__ptr, __alignment, __size) == 0)
198 + return __ptr;
199 + else
200 + return NULL;
201
202 diff --git a/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch b/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch
203 new file mode 100644
204 index 0000000..7e4c58a
205 --- /dev/null
206 +++ b/10.4.0/musl/nocross/50_all_libssp_unconditionally.patch
207 @@ -0,0 +1,24 @@
208 +https://bugs.gentoo.org/706210
209 +https://bugs.gentoo.org/747346
210 +
211 +Author: Timo Teräs <timo.teras@×××.fi>
212 +
213 +"Alpine musl package provides libssp_nonshared.a. We link to it unconditionally,
214 +as otherwise we get link failures if some objects are -fstack-protector built
215 +and final link happens with -fno-stack-protector. This seems to be the common
216 +case when bootstrapping gcc, the piepatches do not seem to fully fix the
217 +crosstoolchain and bootstrap sequence wrt. stack-protector flag usage."
218 +
219 +(We do the same in Gentoo.)
220 +--- gcc-6.1.0/gcc/gcc.c.orig
221 ++++ gcc-6.1.0/gcc/gcc.c
222 +@@ -870,8 +870,7 @@
223 +
224 + #ifndef LINK_SSP_SPEC
225 + #ifdef TARGET_LIBC_PROVIDES_SSP
226 +-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
227 +- "|fstack-protector-strong|fstack-protector-explicit:}"
228 ++#define LINK_SSP_SPEC "-lssp_nonshared"
229 + #else
230 + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
231 + "|fstack-protector-strong|fstack-protector-explicit" \