1 |
commit: 93c6a619de1cea61f0d05a9b37d0efa0be1d1931 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 15 21:36:14 2018 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 15 21:36:14 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=93c6a619 |
7 |
|
8 |
7.3.0: fix building against glibc-2.28 (ustat.h) |
9 |
|
10 |
All patches are taken as-is from gcc-7-branch. |
11 |
|
12 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
13 |
|
14 |
.../94_all_libgo-remove-ustat.h-glibc-2.28.patch | 171 +++++++++++++++++++++ |
15 |
...bsanitizer-avoidustat.h-glibc-2.28-part-1.patch | 67 ++++++++ |
16 |
...bsanitizer-avoidustat.h-glibc-2.28-part-2.patch | 32 ++++ |
17 |
7.3.0/gentoo/README.history | 4 + |
18 |
4 files changed, 274 insertions(+) |
19 |
|
20 |
diff --git a/7.3.0/gentoo/94_all_libgo-remove-ustat.h-glibc-2.28.patch b/7.3.0/gentoo/94_all_libgo-remove-ustat.h-glibc-2.28.patch |
21 |
new file mode 100644 |
22 |
index 0000000..ec80018 |
23 |
--- /dev/null |
24 |
+++ b/7.3.0/gentoo/94_all_libgo-remove-ustat.h-glibc-2.28.patch |
25 |
@@ -0,0 +1,171 @@ |
26 |
+From 66c953ac7dd5902346d6c6d09a9efd1eb4fc3a79 Mon Sep 17 00:00:00 2001 |
27 |
+From: ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> |
28 |
+Date: Fri, 22 Jun 2018 14:25:18 +0000 |
29 |
+Subject: [PATCH] syscall: remove Ustat |
30 |
+ |
31 |
+ glibc 2.28 removes ustat.h and the ustat function entirely, which |
32 |
+ breaks syscall.Ustat. |
33 |
+ |
34 |
+ Updates golang/go#25990 |
35 |
+ |
36 |
+ Reviewed-on: https://go-review.googlesource.com/120535 |
37 |
+ |
38 |
+ |
39 |
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@261894 138bc75d-0d04-0410-961f-82ee72b054a4 |
40 |
+--- |
41 |
+ libgo/config.h.in | 3 --- |
42 |
+ libgo/configure | 33 ------------------------- |
43 |
+ libgo/configure.ac | 18 -------------- |
44 |
+ libgo/go/syscall/libcall_linux_ustat.go | 12 --------- |
45 |
+ libgo/mksysinfo.sh | 14 ----------- |
46 |
+ libgo/sysinfo.c | 3 --- |
47 |
+ 6 files changed, 83 deletions(-) |
48 |
+ delete mode 100644 libgo/go/syscall/libcall_linux_ustat.go |
49 |
+ |
50 |
+diff --git a/libgo/config.h.in b/libgo/config.h.in |
51 |
+index a7b1d47ac9b..312da8b2837 100644 |
52 |
+--- a/libgo/config.h.in |
53 |
++++ b/libgo/config.h.in |
54 |
+@@ -340,9 +340,6 @@ |
55 |
+ /* Define to 1 if you have the `unshare' function. */ |
56 |
+ #undef HAVE_UNSHARE |
57 |
+ |
58 |
+-/* Define to 1 if you have the <ustat.h> header file and it works. */ |
59 |
+-#undef HAVE_USTAT_H |
60 |
+- |
61 |
+ /* Define to 1 if you have the `utimensat' function. */ |
62 |
+ #undef HAVE_UTIMENSAT |
63 |
+ |
64 |
+diff --git a/libgo/configure b/libgo/configure |
65 |
+index 1d3d714fc05..94c42f67e82 100755 |
66 |
+--- a/libgo/configure |
67 |
++++ b/libgo/configure |
68 |
+@@ -14784,39 +14784,6 @@ fi |
69 |
+ done |
70 |
+ |
71 |
+ |
72 |
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <ustat.h> can be used" >&5 |
73 |
+-$as_echo_n "checking whether <ustat.h> can be used... " >&6; } |
74 |
+-if test "${libgo_cv_c_ustat_h+set}" = set; then : |
75 |
+- $as_echo_n "(cached) " >&6 |
76 |
+-else |
77 |
+- CFLAGS_hold=$CFLAGS |
78 |
+-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS" |
79 |
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
80 |
+-/* end confdefs.h. */ |
81 |
+- |
82 |
+-#include <sys/types.h> |
83 |
+-#ifdef HAVE_LINUX_FILTER_H |
84 |
+-#include <linux/filter.h> |
85 |
+-#endif |
86 |
+-#include <ustat.h> |
87 |
+- |
88 |
+-_ACEOF |
89 |
+-if ac_fn_c_try_compile "$LINENO"; then : |
90 |
+- libgo_cv_c_ustat_h=yes |
91 |
+-else |
92 |
+- libgo_cv_c_ustat_h=no |
93 |
+-fi |
94 |
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
95 |
+-CFLAGS=$CFLAGS_hold |
96 |
+-fi |
97 |
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_ustat_h" >&5 |
98 |
+-$as_echo "$libgo_cv_c_ustat_h" >&6; } |
99 |
+-if test $libgo_cv_c_ustat_h = yes; then |
100 |
+- |
101 |
+-$as_echo "#define HAVE_USTAT_H 1" >>confdefs.h |
102 |
+- |
103 |
+-fi |
104 |
+- |
105 |
+ if test "$ac_cv_header_sys_mman_h" = yes; then |
106 |
+ HAVE_SYS_MMAN_H_TRUE= |
107 |
+ HAVE_SYS_MMAN_H_FALSE='#' |
108 |
+diff --git a/libgo/configure.ac b/libgo/configure.ac |
109 |
+index 51b2c161846..0adbadf20d4 100644 |
110 |
+--- a/libgo/configure.ac |
111 |
++++ b/libgo/configure.ac |
112 |
+@@ -572,24 +572,6 @@ AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h |
113 |
+ #endif |
114 |
+ ]) |
115 |
+ |
116 |
+-AC_CACHE_CHECK([whether <ustat.h> can be used], |
117 |
+-[libgo_cv_c_ustat_h], |
118 |
+-[CFLAGS_hold=$CFLAGS |
119 |
+-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS" |
120 |
+-AC_COMPILE_IFELSE( |
121 |
+-[AC_LANG_SOURCE([ |
122 |
+-#include <sys/types.h> |
123 |
+-#ifdef HAVE_LINUX_FILTER_H |
124 |
+-#include <linux/filter.h> |
125 |
+-#endif |
126 |
+-#include <ustat.h> |
127 |
+-])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no]) |
128 |
+-CFLAGS=$CFLAGS_hold]) |
129 |
+-if test $libgo_cv_c_ustat_h = yes; then |
130 |
+- AC_DEFINE(HAVE_USTAT_H, 1, |
131 |
+- [Define to 1 if you have the <ustat.h> header file and it works.]) |
132 |
+-fi |
133 |
+- |
134 |
+ AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes) |
135 |
+ |
136 |
+ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr) |
137 |
+diff --git a/libgo/go/syscall/libcall_linux_ustat.go b/libgo/go/syscall/libcall_linux_ustat.go |
138 |
+deleted file mode 100644 |
139 |
+index 261f086f47e..00000000000 |
140 |
+--- a/libgo/go/syscall/libcall_linux_ustat.go |
141 |
++++ /dev/null |
142 |
+@@ -1,12 +0,0 @@ |
143 |
+-// Copyright 2015 The Go Authors. All rights reserved. |
144 |
+-// Use of this source code is governed by a BSD-style |
145 |
+-// license that can be found in the LICENSE file. |
146 |
+- |
147 |
+-// GNU/Linux library ustat call. |
148 |
+-// This is not supported on some kernels, such as arm64. |
149 |
+-// +build !arm64 |
150 |
+- |
151 |
+-package syscall |
152 |
+- |
153 |
+-//sys Ustat(dev int, ubuf *Ustat_t) (err error) |
154 |
+-//ustat(dev _dev_t, ubuf *Ustat_t) _C_int |
155 |
+diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh |
156 |
+index 61d39d7e2dd..2284928ae53 100755 |
157 |
+--- a/libgo/mksysinfo.sh |
158 |
++++ b/libgo/mksysinfo.sh |
159 |
+@@ -1107,20 +1107,6 @@ grep '^type _sysinfo ' gen-sysinfo.go | \ |
160 |
+ -e 's/mem_unit/Unit/' \ |
161 |
+ >> ${OUT} |
162 |
+ |
163 |
+-# The ustat struct. |
164 |
+-grep '^type _ustat ' gen-sysinfo.go | \ |
165 |
+- sed -e 's/_ustat/Ustat_t/' \ |
166 |
+- -e 's/f_tfree/Tfree/' \ |
167 |
+- -e 's/f_tinode/Tinoe/' \ |
168 |
+- -e 's/f_fname/Fname/' \ |
169 |
+- -e 's/f_fpack/Fpack/' \ |
170 |
+- >> ${OUT} |
171 |
+-# Force it to be defined, as on some older GNU/Linux systems the |
172 |
+-# header file fails when using with <linux/filter.h>. |
173 |
+-if ! grep 'type _ustat ' gen-sysinfo.go >/dev/null 2>&1; then |
174 |
+- echo 'type Ustat_t struct { Tfree int32; Tinoe uint64; Fname [5+1]int8; Fpack [5+1]int8; }' >> ${OUT} |
175 |
+-fi |
176 |
+- |
177 |
+ # The utimbuf struct. |
178 |
+ grep '^type _utimbuf ' gen-sysinfo.go | \ |
179 |
+ sed -e 's/_utimbuf/Utimbuf/' \ |
180 |
+diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c |
181 |
+index a1afc7d119c..7ff721816f9 100644 |
182 |
+--- a/libgo/sysinfo.c |
183 |
++++ b/libgo/sysinfo.c |
184 |
+@@ -135,9 +135,6 @@ |
185 |
+ #if defined(HAVE_SYS_SYSINFO_H) |
186 |
+ #include <sys/sysinfo.h> |
187 |
+ #endif |
188 |
+-#if defined(HAVE_USTAT_H) |
189 |
+-#include <ustat.h> |
190 |
+-#endif |
191 |
+ #if defined(HAVE_UTIME_H) |
192 |
+ #include <utime.h> |
193 |
+ #endif |
194 |
+-- |
195 |
+2.18.0 |
196 |
+ |
197 |
|
198 |
diff --git a/7.3.0/gentoo/95_all_libsanitizer-avoidustat.h-glibc-2.28-part-1.patch b/7.3.0/gentoo/95_all_libsanitizer-avoidustat.h-glibc-2.28-part-1.patch |
199 |
new file mode 100644 |
200 |
index 0000000..a2da9b1 |
201 |
--- /dev/null |
202 |
+++ b/7.3.0/gentoo/95_all_libsanitizer-avoidustat.h-glibc-2.28-part-1.patch |
203 |
@@ -0,0 +1,67 @@ |
204 |
+From 61f38c64c01a15560026115a157b7021ec67bd3b Mon Sep 17 00:00:00 2001 |
205 |
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> |
206 |
+Date: Thu, 24 May 2018 20:21:54 +0000 |
207 |
+Subject: [PATCH] libsanitizer: Use pre-computed size of struct ustat for Linux |
208 |
+ |
209 |
+Cherry-pick compiler-rt revision 333213: |
210 |
+ |
211 |
+<sys/ustat.h> has been removed from glibc 2.28 by: |
212 |
+ |
213 |
+commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7 |
214 |
+Author: Adhemerval Zanella <adhemerval.zanella@××××××.org> |
215 |
+Date: Sun Mar 18 11:28:59 2018 +0800 |
216 |
+ |
217 |
+ Deprecate ustat syscall interface |
218 |
+ |
219 |
+This patch uses pre-computed size of struct ustat for Linux. |
220 |
+ |
221 |
+ PR sanitizer/85835 |
222 |
+ * sanitizer_common/sanitizer_platform_limits_posix.cc: Don't |
223 |
+ include <sys/ustat.h> for Linux. |
224 |
+ (SIZEOF_STRUCT_USTAT): New. |
225 |
+ (struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux. |
226 |
+ |
227 |
+ |
228 |
+ |
229 |
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@260688 138bc75d-0d04-0410-961f-82ee72b054a4 |
230 |
+--- |
231 |
+ libsanitizer/ChangeLog | 8 ++++++++ |
232 |
+ .../sanitizer_platform_limits_posix.cc | 15 +++++++++++++-- |
233 |
+ 2 files changed, 21 insertions(+), 2 deletions(-) |
234 |
+ |
235 |
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
236 |
+index 31a5e697eae..8017afd21c5 100644 |
237 |
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
238 |
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
239 |
+@@ -154,7 +154,6 @@ typedef struct user_fpregs elf_fpregset_t; |
240 |
+ # include <sys/procfs.h> |
241 |
+ #endif |
242 |
+ #include <sys/user.h> |
243 |
+-#include <sys/ustat.h> |
244 |
+ #include <linux/cyclades.h> |
245 |
+ #include <linux/if_eql.h> |
246 |
+ #include <linux/if_plip.h> |
247 |
+@@ -247,7 +246,19 @@ namespace __sanitizer { |
248 |
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD |
249 |
+ |
250 |
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID |
251 |
+- unsigned struct_ustat_sz = sizeof(struct ustat); |
252 |
++ // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which |
253 |
++ // has been removed from glibc 2.28. |
254 |
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ |
255 |
++ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ |
256 |
++ || defined(__x86_64__) |
257 |
++#define SIZEOF_STRUCT_USTAT 32 |
258 |
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ |
259 |
++ || defined(__powerpc__) || defined(__s390__) |
260 |
++#define SIZEOF_STRUCT_USTAT 20 |
261 |
++#else |
262 |
++#error Unknown size of struct ustat |
263 |
++#endif |
264 |
++ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; |
265 |
+ unsigned struct_rlimit64_sz = sizeof(struct rlimit64); |
266 |
+ unsigned struct_statvfs64_sz = sizeof(struct statvfs64); |
267 |
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID |
268 |
+-- |
269 |
+2.18.0 |
270 |
+ |
271 |
|
272 |
diff --git a/7.3.0/gentoo/96_all_libsanitizer-avoidustat.h-glibc-2.28-part-2.patch b/7.3.0/gentoo/96_all_libsanitizer-avoidustat.h-glibc-2.28-part-2.patch |
273 |
new file mode 100644 |
274 |
index 0000000..e9b5c8f |
275 |
--- /dev/null |
276 |
+++ b/7.3.0/gentoo/96_all_libsanitizer-avoidustat.h-glibc-2.28-part-2.patch |
277 |
@@ -0,0 +1,32 @@ |
278 |
+From 6a7c93905151724f7169612d64a5c8ce45dff9fb Mon Sep 17 00:00:00 2001 |
279 |
+From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4> |
280 |
+Date: Thu, 31 May 2018 09:59:35 +0000 |
281 |
+Subject: [PATCH] 2018-05-31 Matthias Klose <doko@××××××.com> |
282 |
+ |
283 |
+ PR sanitizer/86012 |
284 |
+ * sanitizer_common/sanitizer_platform_limits_posix.cc: Define |
285 |
+ SIZEOF_STRUCT_USTAT for 32bit sparc. |
286 |
+ |
287 |
+ |
288 |
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@260992 138bc75d-0d04-0410-961f-82ee72b054a4 |
289 |
+--- |
290 |
+ libsanitizer/ChangeLog | 6 ++++++ |
291 |
+ .../sanitizer_common/sanitizer_platform_limits_posix.cc | 2 +- |
292 |
+ 2 files changed, 7 insertions(+), 1 deletion(-) |
293 |
+ |
294 |
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
295 |
+index 8017afd21c5..97eae3fc7bc 100644 |
296 |
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
297 |
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc |
298 |
+@@ -253,7 +253,7 @@ namespace __sanitizer { |
299 |
+ || defined(__x86_64__) |
300 |
+ #define SIZEOF_STRUCT_USTAT 32 |
301 |
+ #elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ |
302 |
+- || defined(__powerpc__) || defined(__s390__) |
303 |
++ || defined(__powerpc__) || defined(__s390__) || defined(__sparc__) |
304 |
+ #define SIZEOF_STRUCT_USTAT 20 |
305 |
+ #else |
306 |
+ #error Unknown size of struct ustat |
307 |
+-- |
308 |
+2.18.0 |
309 |
+ |
310 |
|
311 |
diff --git a/7.3.0/gentoo/README.history b/7.3.0/gentoo/README.history |
312 |
index 7cc8e55..75814a0 100644 |
313 |
--- a/7.3.0/gentoo/README.history |
314 |
+++ b/7.3.0/gentoo/README.history |
315 |
@@ -1,3 +1,7 @@ |
316 |
+1.5 TODO |
317 |
+ + 94_all_libgo-remove-ustat.h-glibc-2.28.patch |
318 |
+ + 95_all_libsanitizer-avoidustat.h-glibc-2.28-part-1.patch |
319 |
+ + 96_all_libsanitizer-avoidustat.h-glibc-2.28-part-2.patch |
320 |
1.4 18 May 2018 |
321 |
U 13_all_default-ssp-fix.patch |
322 |
1.3 16 May 2018 |