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