1 |
commit: b8f671b0afd2db40863f2ca8150a963c03eac667 |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 11 16:05:16 2020 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 11 16:05:31 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/riscv.git/commit/?id=b8f671b0 |
7 |
|
8 |
sys-libs/glibc: remove copy |
9 |
|
10 |
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> |
11 |
|
12 |
sys-libs/glibc/Manifest | 5 - |
13 |
.../2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch | 32 - |
14 |
.../2.19/glibc-2.19-kernel-2.6.16-compat.patch | 85 -- |
15 |
.../2.19/glibc-2.19-kernel-2.6.16-hide-pipe2.patch | 16 - |
16 |
.../glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c | 303 ---- |
17 |
sys-libs/glibc/files/host.conf-1 | 24 - |
18 |
sys-libs/glibc/files/nscd-1 | 85 -- |
19 |
sys-libs/glibc/files/nscd.service | 15 - |
20 |
sys-libs/glibc/files/nscd.tmpfilesd | 4 - |
21 |
sys-libs/glibc/glibc-2.32-r1.ebuild | 1505 -------------------- |
22 |
sys-libs/glibc/metadata.xml | 23 - |
23 |
11 files changed, 2097 deletions(-) |
24 |
|
25 |
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest |
26 |
deleted file mode 100644 |
27 |
index 783470a..0000000 |
28 |
--- a/sys-libs/glibc/Manifest |
29 |
+++ /dev/null |
30 |
@@ -1,5 +0,0 @@ |
31 |
-DIST backport-rv32.txz 26416 BLAKE2B 7a6b593859f88a3c040f06324dace4cc6137d14d4580fad9ea285829666d761c3dd01c190746e86846c219423124c77a55bc57b6e56efe6401a9c99d7fa445cd SHA512 d08dc02c4f0a3c5a15c57fbb5190588121c0e0728e6ab2119483407a98625efe58b3c83b44d750b0146171e63dcf8a6dbb6d1a057d042f794eed9adbd1f0293e |
32 |
-DIST gcc-multilib-bootstrap-20180511.tar.xz 2392908 BLAKE2B f3cf614399368acd8908f60d894c6344a2fa09383b30c1633a0682bc668367c8a2f8c6fec2d41b6e2178d709a2bd8db57e8b2ab56ba263c7d56f819c15acd061 SHA512 98c766e913693ab42ff790557acde2a36a8001e2648046a685b21964200df8d4d52d8452d499c0068c6648284d086ce062c2d36e2c6c2fd8aacd232d193f2853 |
33 |
-DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349 |
34 |
-DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b |
35 |
-DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db |
36 |
|
37 |
diff --git a/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch b/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch |
38 |
deleted file mode 100644 |
39 |
index 72a616a..0000000 |
40 |
--- a/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch |
41 |
+++ /dev/null |
42 |
@@ -1,32 +0,0 @@ |
43 |
-https://bugs.gentoo.org/503838 |
44 |
-http://gcc.gnu.org/PR60465 |
45 |
-https://sourceware.org/ml/libc-alpha/2015-12/msg00556.html |
46 |
-https://trofi.github.io/posts/189-glibc-on-ia64-or-how-relocations-bootstrap.html |
47 |
- |
48 |
-newer versions of gcc generate relocations in the elf_get_dynamic_info func |
49 |
-which glibc relies on to populate some info structs. those structs are then |
50 |
-used by ldso to process relocations in itself. glibc requires that there are |
51 |
-no relocations until that point (*after* elf_get_dynamic_info), so we end up |
52 |
-crashing during elf_get_dynamic_info because the relocation has not yet been |
53 |
-processed. |
54 |
- |
55 |
-this hack shuffles the code in a way that tricks gcc into not generating the |
56 |
-relocation. we need to figure out something better for upstream. |
57 |
- |
58 |
---- a/elf/get-dynamic-info.h |
59 |
-+++ b/elf/get-dynamic-info.h |
60 |
-@@ -66,8 +66,12 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) |
61 |
- info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
62 |
- + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn; |
63 |
- else if ((d_tag_utype) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM) |
64 |
-- info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
65 |
-- + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn; |
66 |
-+ { |
67 |
-+ d_tag_utype i = |
68 |
-+ DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
69 |
-+ + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM; |
70 |
-+ info[i] = dyn; |
71 |
-+ } |
72 |
- ++dyn; |
73 |
- } |
74 |
- |
75 |
|
76 |
diff --git a/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-compat.patch b/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-compat.patch |
77 |
deleted file mode 100644 |
78 |
index bf75f80..0000000 |
79 |
--- a/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-compat.patch |
80 |
+++ /dev/null |
81 |
@@ -1,85 +0,0 @@ |
82 |
-Remove newer symbols that does not work on linux-2.6.16. |
83 |
- |
84 |
-This is only for Prefix standalone. |
85 |
- |
86 |
-Index: glibc-2.19/io/sys/stat.h |
87 |
-=================================================================== |
88 |
---- glibc-2.19.orig/io/sys/stat.h |
89 |
-+++ glibc-2.19/io/sys/stat.h |
90 |
-@@ -361,10 +361,6 @@ extern int mkfifoat (int __fd, const cha |
91 |
- #ifdef __USE_ATFILE |
92 |
- /* Set file access and modification times relative to directory file |
93 |
- descriptor. */ |
94 |
--extern int utimensat (int __fd, const char *__path, |
95 |
-- const struct timespec __times[2], |
96 |
-- int __flags) |
97 |
-- __THROW __nonnull ((2)); |
98 |
- #endif |
99 |
- |
100 |
- #ifdef __USE_XOPEN2K8 |
101 |
-Index: glibc-2.19/posix/unistd.h |
102 |
-=================================================================== |
103 |
---- glibc-2.19.orig/posix/unistd.h |
104 |
-+++ glibc-2.19/posix/unistd.h |
105 |
-@@ -419,7 +419,6 @@ extern int pipe (int __pipedes[2]) __THR |
106 |
- #ifdef __USE_GNU |
107 |
- /* Same as pipe but apply flags passed in FLAGS to the new file |
108 |
- descriptors. */ |
109 |
--extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur; |
110 |
- #endif |
111 |
- |
112 |
- /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. |
113 |
-Index: glibc-2.19/sysdeps/unix/sysv/linux/x86/bits/epoll.h |
114 |
-=================================================================== |
115 |
---- glibc-2.19.orig/sysdeps/unix/sysv/linux/x86/bits/epoll.h |
116 |
-+++ glibc-2.19/sysdeps/unix/sysv/linux/x86/bits/epoll.h |
117 |
-@@ -19,11 +19,5 @@ |
118 |
- # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead." |
119 |
- #endif |
120 |
- |
121 |
--/* Flags to be passed to epoll_create1. */ |
122 |
--enum |
123 |
-- { |
124 |
-- EPOLL_CLOEXEC = 02000000 |
125 |
--#define EPOLL_CLOEXEC EPOLL_CLOEXEC |
126 |
-- }; |
127 |
- |
128 |
- #define __EPOLL_PACKED __attribute__ ((__packed__)) |
129 |
-Index: glibc-2.19/sysdeps/unix/sysv/linux/bits/fcntl-linux.h |
130 |
-=================================================================== |
131 |
---- glibc-2.19.orig/sysdeps/unix/sysv/linux/bits/fcntl-linux.h |
132 |
-+++ glibc-2.19/sysdeps/unix/sysv/linux/bits/fcntl-linux.h |
133 |
-@@ -187,8 +187,6 @@ |
134 |
- # define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ |
135 |
- #endif |
136 |
- #ifdef __USE_XOPEN2K8 |
137 |
--# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with |
138 |
-- close-on-exit set. */ |
139 |
- #endif |
140 |
- |
141 |
- /* For F_[GET|SET]FD. */ |
142 |
-Index: glibc-2.19/sysdeps/unix/sysv/linux/sys/epoll.h |
143 |
-=================================================================== |
144 |
---- glibc-2.19.orig/sysdeps/unix/sysv/linux/sys/epoll.h |
145 |
-+++ glibc-2.19/sysdeps/unix/sysv/linux/sys/epoll.h |
146 |
-@@ -101,7 +101,6 @@ extern int epoll_create (int __size) __T |
147 |
- |
148 |
- /* Same as epoll_create but with an FLAGS parameter. The unused SIZE |
149 |
- parameter has been dropped. */ |
150 |
--extern int epoll_create1 (int __flags) __THROW; |
151 |
- |
152 |
- |
153 |
- /* Manipulate an epoll instance "epfd". Returns 0 in case of success, |
154 |
-Index: glibc-2.19/time/sys/time.h |
155 |
-=================================================================== |
156 |
---- glibc-2.19.orig/time/sys/time.h |
157 |
-+++ glibc-2.19/time/sys/time.h |
158 |
-@@ -140,8 +140,6 @@ extern int utimes (const char *__file, c |
159 |
- |
160 |
- #ifdef __USE_BSD |
161 |
- /* Same as `utimes', but does not follow symbolic links. */ |
162 |
--extern int lutimes (const char *__file, const struct timeval __tvp[2]) |
163 |
-- __THROW __nonnull ((1)); |
164 |
- |
165 |
- /* Same as `utimes', but takes an open file descriptor instead of a name. */ |
166 |
- extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; |
167 |
|
168 |
diff --git a/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-hide-pipe2.patch b/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-hide-pipe2.patch |
169 |
deleted file mode 100644 |
170 |
index 2b9ccce..0000000 |
171 |
--- a/sys-libs/glibc/files/2.19/glibc-2.19-kernel-2.6.16-hide-pipe2.patch |
172 |
+++ /dev/null |
173 |
@@ -1,16 +0,0 @@ |
174 |
-Remove the pipe2 symbol from libc.so, otherwise meson will pick it up. |
175 |
- |
176 |
-This is a balance. We decide not to strip all the O_CLOEXEC, otherwise |
177 |
-gtk+ will need to be patched. |
178 |
-Index: glibc-2.19/sysdeps/unix/make-syscalls.sh |
179 |
-=================================================================== |
180 |
---- glibc-2.19.orig/sysdeps/unix/make-syscalls.sh |
181 |
-+++ glibc-2.19/sysdeps/unix/make-syscalls.sh |
182 |
-@@ -131,6 +131,7 @@ emit_weak_aliases() |
183 |
- echo " echo 'libc_hidden_def ($name)'; \\" |
184 |
- ;; |
185 |
- *) |
186 |
-+ [ $name = pipe2 ] && continue |
187 |
- echo " echo 'weak_alias ($strong, $name)'; \\" |
188 |
- echo " echo 'libc_hidden_weak ($name)'; \\" |
189 |
- ;; |
190 |
|
191 |
diff --git a/sys-libs/glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c b/sys-libs/glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c |
192 |
deleted file mode 100644 |
193 |
index 2ef96b7..0000000 |
194 |
--- a/sys-libs/glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c |
195 |
+++ /dev/null |
196 |
@@ -1,303 +0,0 @@ |
197 |
-/* Copyright (C) 2004-2014 Free Software Foundation, Inc. |
198 |
- Copyright (C) 2006-2014 Gentoo Foundation Inc. |
199 |
- This file is part of the GNU C Library. |
200 |
- |
201 |
- The GNU C Library is free software; you can redistribute it and/or |
202 |
- modify it under the terms of the GNU Lesser General Public |
203 |
- License as published by the Free Software Foundation; either |
204 |
- version 2.1 of the License, or (at your option) any later version. |
205 |
- |
206 |
- The GNU C Library is distributed in the hope that it will be useful, |
207 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of |
208 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
209 |
- Lesser General Public License for more details. |
210 |
- |
211 |
- You should have received a copy of the GNU Lesser General Public |
212 |
- License along with the GNU C Library; if not, write to the Free |
213 |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
214 |
- 02111-1307 USA. */ |
215 |
- |
216 |
-/* Hardened Gentoo SSP and FORTIFY handler |
217 |
- |
218 |
- A failure handler that does not use functions from the rest of glibc; |
219 |
- it uses the INTERNAL_SYSCALL methods directly. This helps ensure no |
220 |
- possibility of recursion into the handler. |
221 |
- |
222 |
- Direct all bug reports to http://bugs.gentoo.org/ |
223 |
- |
224 |
- People who have contributed significantly to the evolution of this file: |
225 |
- Ned Ludd - <solar[@]gentoo.org> |
226 |
- Alexander Gabert - <pappy[@]gentoo.org> |
227 |
- The PaX Team - <pageexec[@]freemail.hu> |
228 |
- Peter S. Mazinger - <ps.m[@]gmx.net> |
229 |
- Yoann Vandoorselaere - <yoann[@]prelude-ids.org> |
230 |
- Robert Connolly - <robert[@]linuxfromscratch.org> |
231 |
- Cory Visi <cory[@]visi.name> |
232 |
- Mike Frysinger <vapier[@]gentoo.org> |
233 |
- Magnus Granberg <zorry[@]gentoo.org> |
234 |
- Kevin F. Quinn - <kevquinn[@]gentoo.org> |
235 |
- */ |
236 |
- |
237 |
-#include <errno.h> |
238 |
-#include <stdio.h> |
239 |
-#include <stdlib.h> |
240 |
-#include <unistd.h> |
241 |
-#include <signal.h> |
242 |
- |
243 |
-#include <sys/types.h> |
244 |
- |
245 |
-#include <sysdep-cancel.h> |
246 |
-#include <sys/syscall.h> |
247 |
- |
248 |
-#include <kernel-features.h> |
249 |
- |
250 |
-#include <alloca.h> |
251 |
-/* from sysdeps */ |
252 |
-#include <socketcall.h> |
253 |
-/* for the stuff in bits/socket.h */ |
254 |
-#include <sys/socket.h> |
255 |
-#include <sys/un.h> |
256 |
- |
257 |
-/* Sanity check on SYSCALL macro names - force compilation |
258 |
- * failure if the names used here do not exist |
259 |
- */ |
260 |
-#if !defined __NR_socketcall && !defined __NR_socket |
261 |
-# error Cannot do syscall socket or socketcall |
262 |
-#endif |
263 |
-#if !defined __NR_socketcall && !defined __NR_connect |
264 |
-# error Cannot do syscall connect or socketcall |
265 |
-#endif |
266 |
-#ifndef __NR_write |
267 |
-# error Cannot do syscall write |
268 |
-#endif |
269 |
-#ifndef __NR_close |
270 |
-# error Cannot do syscall close |
271 |
-#endif |
272 |
-#ifndef __NR_getpid |
273 |
-# error Cannot do syscall getpid |
274 |
-#endif |
275 |
-#ifndef __NR_kill |
276 |
-# error Cannot do syscall kill |
277 |
-#endif |
278 |
-#ifndef __NR_exit |
279 |
-# error Cannot do syscall exit |
280 |
-#endif |
281 |
-#ifdef SSP_SMASH_DUMPS_CORE |
282 |
-# define ENABLE_SSP_SMASH_DUMPS_CORE 1 |
283 |
-# if !defined _KERNEL_NSIG && !defined _NSIG |
284 |
-# error No _NSIG or _KERNEL_NSIG for rt_sigaction |
285 |
-# endif |
286 |
-# if !defined __NR_sigaction && !defined __NR_rt_sigaction |
287 |
-# error Cannot do syscall sigaction or rt_sigaction |
288 |
-# endif |
289 |
-/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size |
290 |
- * of the _kernel_ sigset_t which is not the same as the user sigset_t. |
291 |
- * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for |
292 |
- * some reason. |
293 |
- */ |
294 |
-# ifdef _KERNEL_NSIG |
295 |
-# define _SSP_NSIG _KERNEL_NSIG |
296 |
-# else |
297 |
-# define _SSP_NSIG _NSIG |
298 |
-# endif |
299 |
-#else |
300 |
-# define _SSP_NSIG 0 |
301 |
-# define ENABLE_SSP_SMASH_DUMPS_CORE 0 |
302 |
-#endif |
303 |
- |
304 |
-/* Define DO_SIGACTION - default to newer rt signal interface but |
305 |
- * fallback to old as needed. |
306 |
- */ |
307 |
-#ifdef __NR_rt_sigaction |
308 |
-# define DO_SIGACTION(signum, act, oldact) \ |
309 |
- INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8) |
310 |
-#else |
311 |
-# define DO_SIGACTION(signum, act, oldact) \ |
312 |
- INLINE_SYSCALL(sigaction, 3, signum, act, oldact) |
313 |
-#endif |
314 |
- |
315 |
-/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */ |
316 |
-#if defined(__NR_socket) && defined(__NR_connect) |
317 |
-# define USE_OLD_SOCKETCALL 0 |
318 |
-#else |
319 |
-# define USE_OLD_SOCKETCALL 1 |
320 |
-#endif |
321 |
- |
322 |
-/* stub out the __NR_'s so we can let gcc optimize away dead code */ |
323 |
-#ifndef __NR_socketcall |
324 |
-# define __NR_socketcall 0 |
325 |
-#endif |
326 |
-#ifndef __NR_socket |
327 |
-# define __NR_socket 0 |
328 |
-#endif |
329 |
-#ifndef __NR_connect |
330 |
-# define __NR_connect 0 |
331 |
-#endif |
332 |
-#define DO_SOCKET(result, domain, type, protocol) \ |
333 |
- do { \ |
334 |
- if (USE_OLD_SOCKETCALL) { \ |
335 |
- socketargs[0] = domain; \ |
336 |
- socketargs[1] = type; \ |
337 |
- socketargs[2] = protocol; \ |
338 |
- socketargs[3] = 0; \ |
339 |
- result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \ |
340 |
- } else \ |
341 |
- result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \ |
342 |
- } while (0) |
343 |
-#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \ |
344 |
- do { \ |
345 |
- if (USE_OLD_SOCKETCALL) { \ |
346 |
- socketargs[0] = sockfd; \ |
347 |
- socketargs[1] = (unsigned long int)serv_addr; \ |
348 |
- socketargs[2] = addrlen; \ |
349 |
- socketargs[3] = 0; \ |
350 |
- result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \ |
351 |
- } else \ |
352 |
- result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \ |
353 |
- } while (0) |
354 |
- |
355 |
-#ifndef _PATH_LOG |
356 |
-# define _PATH_LOG "/dev/log" |
357 |
-#endif |
358 |
- |
359 |
-static const char path_log[] = _PATH_LOG; |
360 |
- |
361 |
-/* For building glibc with SSP switched on, define __progname to a |
362 |
- * constant if building for the run-time loader, to avoid pulling |
363 |
- * in more of libc.so into ld.so |
364 |
- */ |
365 |
-#ifdef IS_IN_rtld |
366 |
-static const char *__progname = "<ldso>"; |
367 |
-#else |
368 |
-extern const char *__progname; |
369 |
-#endif |
370 |
- |
371 |
-#ifdef GENTOO_SSP_HANDLER |
372 |
-# define ERROR_MSG "stack smashing" |
373 |
-#else |
374 |
-# define ERROR_MSG "buffer overflow" |
375 |
-#endif |
376 |
- |
377 |
-/* Common handler code, used by chk_fail |
378 |
- * Inlined to ensure no self-references to the handler within itself. |
379 |
- * Data static to avoid putting more than necessary on the stack, |
380 |
- * to aid core debugging. |
381 |
- */ |
382 |
-__attribute__ ((__noreturn__, __always_inline__)) |
383 |
-static inline void |
384 |
-__hardened_gentoo_fail(void) |
385 |
-{ |
386 |
-#define MESSAGE_BUFSIZ 512 |
387 |
- static pid_t pid; |
388 |
- static int plen, i, hlen; |
389 |
- static char message[MESSAGE_BUFSIZ]; |
390 |
- /* <11> is LOG_USER|LOG_ERR. A dummy date for loggers to skip over. */ |
391 |
- static const char msg_header[] = "<11>" __DATE__ " " __TIME__ " glibc-gentoo-hardened-check: "; |
392 |
- static const char msg_ssd[] = "*** " ERROR_MSG " detected ***: "; |
393 |
- static const char msg_terminated[] = " terminated; "; |
394 |
- static const char msg_report[] = "report to " REPORT_BUGS_TO "\n"; |
395 |
- static const char msg_unknown[] = "<unknown>"; |
396 |
- static int log_socket, connect_result; |
397 |
- static struct sockaddr_un sock; |
398 |
- static unsigned long int socketargs[4]; |
399 |
- |
400 |
- /* Build socket address */ |
401 |
- sock.sun_family = AF_UNIX; |
402 |
- i = 0; |
403 |
- while (path_log[i] != '\0' && i < sizeof(sock.sun_path) - 1) { |
404 |
- sock.sun_path[i] = path_log[i]; |
405 |
- ++i; |
406 |
- } |
407 |
- sock.sun_path[i] = '\0'; |
408 |
- |
409 |
- /* Try SOCK_DGRAM connection to syslog */ |
410 |
- connect_result = -1; |
411 |
- DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0); |
412 |
- if (log_socket != -1) |
413 |
- DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock)); |
414 |
- if (connect_result == -1) { |
415 |
- if (log_socket != -1) |
416 |
- INLINE_SYSCALL(close, 1, log_socket); |
417 |
- /* Try SOCK_STREAM connection to syslog */ |
418 |
- DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0); |
419 |
- if (log_socket != -1) |
420 |
- DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock)); |
421 |
- } |
422 |
- |
423 |
- /* Build message. Messages are generated both in the old style and new style, |
424 |
- * so that log watchers that are configured for the old-style message continue |
425 |
- * to work. |
426 |
- */ |
427 |
-#define strconcat(str) \ |
428 |
- ({ \ |
429 |
- i = 0; \ |
430 |
- while ((str[i] != '\0') && ((i + plen) < (MESSAGE_BUFSIZ - 1))) { \ |
431 |
- message[plen + i] = str[i]; \ |
432 |
- ++i; \ |
433 |
- } \ |
434 |
- plen += i; \ |
435 |
- }) |
436 |
- |
437 |
- /* Tersely log the failure */ |
438 |
- plen = 0; |
439 |
- strconcat(msg_header); |
440 |
- hlen = plen; |
441 |
- strconcat(msg_ssd); |
442 |
- if (__progname != NULL) |
443 |
- strconcat(__progname); |
444 |
- else |
445 |
- strconcat(msg_unknown); |
446 |
- strconcat(msg_terminated); |
447 |
- strconcat(msg_report); |
448 |
- |
449 |
- /* Write out error message to STDERR, to syslog if open */ |
450 |
- INLINE_SYSCALL(write, 3, STDERR_FILENO, message + hlen, plen - hlen); |
451 |
- if (connect_result != -1) { |
452 |
- INLINE_SYSCALL(write, 3, log_socket, message, plen); |
453 |
- INLINE_SYSCALL(close, 1, log_socket); |
454 |
- } |
455 |
- |
456 |
- /* Time to kill self since we have no idea what is going on */ |
457 |
- pid = INLINE_SYSCALL(getpid, 0); |
458 |
- |
459 |
- if (ENABLE_SSP_SMASH_DUMPS_CORE) { |
460 |
- /* Remove any user-supplied handler for SIGABRT, before using it. */ |
461 |
-#if 0 |
462 |
- /* |
463 |
- * Note: Disabled because some programs catch & process their |
464 |
- * own crashes. We've already enabled this code path which |
465 |
- * means we want to let core dumps happen. |
466 |
- */ |
467 |
- static struct sigaction default_abort_act; |
468 |
- default_abort_act.sa_handler = SIG_DFL; |
469 |
- default_abort_act.sa_sigaction = NULL; |
470 |
- __sigfillset(&default_abort_act.sa_mask); |
471 |
- default_abort_act.sa_flags = 0; |
472 |
- if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0) |
473 |
-#endif |
474 |
- INLINE_SYSCALL(kill, 2, pid, SIGABRT); |
475 |
- } |
476 |
- |
477 |
- /* SIGKILL is only signal which cannot be caught */ |
478 |
- INLINE_SYSCALL(kill, 2, pid, SIGKILL); |
479 |
- |
480 |
- /* In case the kill didn't work, exit anyway. |
481 |
- * The loop prevents gcc thinking this routine returns. |
482 |
- */ |
483 |
- while (1) |
484 |
- INLINE_SYSCALL(exit, 1, 137); |
485 |
-} |
486 |
- |
487 |
-__attribute__ ((__noreturn__)) |
488 |
-#ifdef GENTOO_SSP_HANDLER |
489 |
-void __stack_chk_fail(void) |
490 |
-#else |
491 |
-void __chk_fail(void) |
492 |
-#endif |
493 |
-{ |
494 |
- __hardened_gentoo_fail(); |
495 |
-} |
496 |
- |
497 |
-#ifdef GENTOO_SSP_HANDLER |
498 |
-strong_alias (__stack_chk_fail, __stack_chk_fail_local) |
499 |
-#endif |
500 |
|
501 |
diff --git a/sys-libs/glibc/files/host.conf-1 b/sys-libs/glibc/files/host.conf-1 |
502 |
deleted file mode 100644 |
503 |
index 4c58e52..0000000 |
504 |
--- a/sys-libs/glibc/files/host.conf-1 |
505 |
+++ /dev/null |
506 |
@@ -1,24 +0,0 @@ |
507 |
-# /etc/host.conf: |
508 |
-# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/host.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $ |
509 |
- |
510 |
-# The file /etc/host.conf contains configuration information specific to |
511 |
-# the resolver library. It should contain one configuration keyword per |
512 |
-# line, followed by appropriate configuration information. The keywords |
513 |
-# recognized are order, trim, mdns, multi, nospoof, spoof, and reorder. |
514 |
- |
515 |
- |
516 |
- |
517 |
-# This keyword specifies how host lookups are to be performed. It |
518 |
-# should be followed by one or more lookup methods, separated by |
519 |
-# commas. Valid methods are bind, hosts, and nis. |
520 |
-# |
521 |
-order hosts, bind |
522 |
- |
523 |
- |
524 |
-# Valid values are on and off. If set to on, the resolv+ library |
525 |
-# will return all valid addresses for a host that appears in the |
526 |
-# /etc/hosts file, instead of only the first. This is off by |
527 |
-# default, as it may cause a substantial performance loss at sites |
528 |
-# with large hosts files. |
529 |
-# |
530 |
-multi off |
531 |
|
532 |
diff --git a/sys-libs/glibc/files/nscd-1 b/sys-libs/glibc/files/nscd-1 |
533 |
deleted file mode 100644 |
534 |
index f69c8e2..0000000 |
535 |
--- a/sys-libs/glibc/files/nscd-1 |
536 |
+++ /dev/null |
537 |
@@ -1,85 +0,0 @@ |
538 |
-#!/sbin/openrc-run |
539 |
-# Copyright 1999-2020 Gentoo Authors |
540 |
-# Distributed under the terms of the GNU General Public License v2 |
541 |
- |
542 |
-description="The 'Name Service Cache Daemon' is a daemon that provides a cache" |
543 |
-description="${description} for the most common name service requests" |
544 |
- |
545 |
-extra_started_commands="flush_all flush_hosts flush_group flush_passwd flush_netgroup flush_services" |
546 |
- |
547 |
-description_flush_all="Will invalidate hosts, group, passwd, netgroup and services cache" |
548 |
-description_flush_hosts="Will invalidate hosts cache" |
549 |
-description_flush_group="Will invalidate group cache" |
550 |
-description_flush_passwd="Will invalidate passwd cache" |
551 |
-description_flush_netgroup="Will invalidate netgroup cache" |
552 |
-description_flush_services="Will invalidate services cache" |
553 |
- |
554 |
-pidfile="/run/nscd/nscd.pid" |
555 |
-command="/usr/sbin/nscd" |
556 |
- |
557 |
-depend() { |
558 |
- use dns ldap net slapd logger |
559 |
-} |
560 |
- |
561 |
-checkconfig() { |
562 |
- if [ ! -d /run/nscd ] ; then |
563 |
- checkpath -d -m 755 /run/nscd |
564 |
- fi |
565 |
- |
566 |
- if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /run/nscd)" != "755" ] ; then |
567 |
- ewarn "nscd run dir is not world readable, you should reset the perms:" |
568 |
- ewarn "chmod 755 /run/nscd" |
569 |
- ewarn "chmod a+rw /run/nscd/socket" |
570 |
- ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd" |
571 |
- fi |
572 |
- |
573 |
- if grep -qs '^[[:space:]]*persistent\>' /etc/nscd.conf ; then |
574 |
- checkpath -d -m 700 /var/db/nscd |
575 |
- fi |
576 |
-} |
577 |
- |
578 |
-_flush() { |
579 |
- local table=$1 |
580 |
- |
581 |
- ebegin "Flushing ${table} table" |
582 |
- ${command} --invalidate ${table} |
583 |
- eend $? |
584 |
-} |
585 |
- |
586 |
-flush_all() { |
587 |
- local has_errors=0 |
588 |
- |
589 |
- ebegin "Flushing all caches" |
590 |
- |
591 |
- local table= |
592 |
- for table in passwd group hosts netgroup services; do |
593 |
- ${command} --invalidate ${table} |
594 |
- [ $? -ne 0 ] && has_errors=1 |
595 |
- done |
596 |
- |
597 |
- eend ${has_errors} |
598 |
-} |
599 |
- |
600 |
-flush_hosts() { |
601 |
- _flush hosts |
602 |
-} |
603 |
- |
604 |
-flush_group() { |
605 |
- _flush group |
606 |
-} |
607 |
- |
608 |
-flush_passwd() { |
609 |
- _flush passwd |
610 |
-} |
611 |
- |
612 |
-flush_netgroup() { |
613 |
- _flush netgroup |
614 |
-} |
615 |
- |
616 |
-flush_services() { |
617 |
- _flush services |
618 |
-} |
619 |
- |
620 |
-start_pre() { |
621 |
- checkconfig |
622 |
-} |
623 |
|
624 |
diff --git a/sys-libs/glibc/files/nscd.service b/sys-libs/glibc/files/nscd.service |
625 |
deleted file mode 100644 |
626 |
index 25a3b1d..0000000 |
627 |
--- a/sys-libs/glibc/files/nscd.service |
628 |
+++ /dev/null |
629 |
@@ -1,15 +0,0 @@ |
630 |
-[Unit] |
631 |
-Description=Name Service Cache Daemon |
632 |
-After=network.target |
633 |
- |
634 |
-[Service] |
635 |
-ExecStart=/usr/sbin/nscd -F |
636 |
-ExecStop=/usr/sbin/nscd --shutdown |
637 |
-ExecReload=/usr/sbin/nscd -i passwd |
638 |
-ExecReload=/usr/sbin/nscd -i group |
639 |
-ExecReload=/usr/sbin/nscd -i hosts |
640 |
-ExecReload=/usr/sbin/nscd -i services |
641 |
-Restart=always |
642 |
- |
643 |
-[Install] |
644 |
-WantedBy=multi-user.target |
645 |
|
646 |
diff --git a/sys-libs/glibc/files/nscd.tmpfilesd b/sys-libs/glibc/files/nscd.tmpfilesd |
647 |
deleted file mode 100644 |
648 |
index 52edbba..0000000 |
649 |
--- a/sys-libs/glibc/files/nscd.tmpfilesd |
650 |
+++ /dev/null |
651 |
@@ -1,4 +0,0 @@ |
652 |
-# Configuration to create /run/nscd directory |
653 |
-# Used as part of systemd's tmpfiles |
654 |
- |
655 |
-d /run/nscd 0755 root root |
656 |
|
657 |
diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild |
658 |
deleted file mode 100644 |
659 |
index b510245..0000000 |
660 |
--- a/sys-libs/glibc/glibc-2.32-r1.ebuild |
661 |
+++ /dev/null |
662 |
@@ -1,1505 +0,0 @@ |
663 |
-# Copyright 1999-2020 Gentoo Authors |
664 |
-# Distributed under the terms of the GNU General Public License v2 |
665 |
- |
666 |
-EAPI=7 |
667 |
- |
668 |
-PYTHON_COMPAT=( python3_{6,7,8} ) |
669 |
- |
670 |
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \ |
671 |
- multilib systemd multiprocessing |
672 |
- |
673 |
-DESCRIPTION="GNU libc C library" |
674 |
-HOMEPAGE="https://www.gnu.org/software/libc/" |
675 |
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
676 |
-SLOT="2.2" |
677 |
- |
678 |
-EMULTILIB_PKG="true" |
679 |
- |
680 |
-# Gentoo patchset (ignored for live ebuilds) |
681 |
-PATCH_VER=1 |
682 |
-PATCH_DEV=dilfridge |
683 |
- |
684 |
-if [[ ${PV} == 9999* ]]; then |
685 |
- inherit git-r3 |
686 |
-else |
687 |
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
688 |
- SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
689 |
- SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz" |
690 |
- SRC_URI+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )" |
691 |
-fi |
692 |
- |
693 |
-RELEASE_VER=${PV} |
694 |
- |
695 |
-GCC_BOOTSTRAP_VER=20180511 |
696 |
- |
697 |
-LOCALE_GEN_VER=2.10 |
698 |
- |
699 |
-SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz" |
700 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
701 |
- |
702 |
-IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs static-pie suid systemtap test vanilla" |
703 |
- |
704 |
-# Minimum kernel version that glibc requires |
705 |
-MIN_KERN_VER="3.2.0" |
706 |
- |
707 |
-# Here's how the cross-compile logic breaks down ... |
708 |
-# CTARGET - machine that will target the binaries |
709 |
-# CHOST - machine that will host the binaries |
710 |
-# CBUILD - machine that will build the binaries |
711 |
-# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
712 |
-# If CHOST != CBUILD, it means you want to cross-compile the libc. |
713 |
-# CBUILD = CHOST = CTARGET - native build/install |
714 |
-# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
715 |
-# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
716 |
-# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
717 |
-# For install paths: |
718 |
-# CHOST = CTARGET - install into / |
719 |
-# CHOST != CTARGET - install into /usr/CTARGET/ |
720 |
-# |
721 |
-export CBUILD=${CBUILD:-${CHOST}} |
722 |
-export CTARGET=${CTARGET:-${CHOST}} |
723 |
-if [[ ${CTARGET} == ${CHOST} ]] ; then |
724 |
- if [[ ${CATEGORY} == cross-* ]] ; then |
725 |
- export CTARGET=${CATEGORY#cross-} |
726 |
- fi |
727 |
-fi |
728 |
- |
729 |
-# Note [Disable automatic stripping] |
730 |
-# Disabling automatic stripping for a few reasons: |
731 |
-# - portage's attempt to strip breaks non-native binaries at least on |
732 |
-# arm: bug #697428 |
733 |
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
734 |
-# enumeration: bug #697910. This is quite subtle: |
735 |
-# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
736 |
-# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
737 |
-# via 'ps_pglobal_lookup' symbol defined in gdb. |
738 |
-# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
739 |
-# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
740 |
-# (unexported) is used to sanity check compatibility before enabling |
741 |
-# debugging. |
742 |
-# Also see https://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint |
743 |
-# * normal 'strip' command trims '.symtab' |
744 |
-# Thus our main goal here is to prevent 'libpthread.so.0' from |
745 |
-# losing it's '.symtab' entries. |
746 |
-# As Gentoo's strip does not allow us to pass less aggressive stripping |
747 |
-# options and does not check the machine target we strip selectively. |
748 |
- |
749 |
-# We need a new-enough binutils/gcc to match upstream baseline. |
750 |
-# Also we need to make sure our binutils/gcc supports TLS, |
751 |
-# and that gcc already contains the hardened patches. |
752 |
-# Lastly, let's avoid some openssh nastiness, bug 708224, as |
753 |
-# convenience to our users. |
754 |
-BDEPEND=" |
755 |
- ${PYTHON_DEPS} |
756 |
- >=app-misc/pax-utils-0.1.10 |
757 |
- sys-devel/bison |
758 |
- doc? ( sys-apps/texinfo ) |
759 |
-" |
760 |
-COMMON_DEPEND=" |
761 |
- gd? ( media-libs/gd:2= ) |
762 |
- nscd? ( selinux? ( |
763 |
- audit? ( sys-process/audit ) |
764 |
- caps? ( sys-libs/libcap ) |
765 |
- ) ) |
766 |
- suid? ( caps? ( sys-libs/libcap ) ) |
767 |
- selinux? ( sys-libs/libselinux ) |
768 |
- systemtap? ( dev-util/systemtap ) |
769 |
- !<net-misc/openssh-8.1_p1-r2 |
770 |
-" |
771 |
-DEPEND="${COMMON_DEPEND} |
772 |
- test? ( >=net-dns/libidn2-2.3.0 ) |
773 |
-" |
774 |
-RDEPEND="${COMMON_DEPEND} |
775 |
- sys-apps/gentoo-functions |
776 |
-" |
777 |
- |
778 |
-RESTRICT="!test? ( test )" |
779 |
- |
780 |
-if [[ ${CATEGORY} == cross-* ]] ; then |
781 |
- BDEPEND+=" !headers-only? ( |
782 |
- >=${CATEGORY}/binutils-2.24 |
783 |
- >=${CATEGORY}/gcc-6 |
784 |
- )" |
785 |
- [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
786 |
-else |
787 |
- BDEPEND+=" |
788 |
- >=sys-devel/binutils-2.24 |
789 |
- >=sys-devel/gcc-6 |
790 |
- " |
791 |
- DEPEND+=" virtual/os-headers " |
792 |
- RDEPEND+=" |
793 |
- >=net-dns/libidn2-2.3.0 |
794 |
- vanilla? ( !sys-libs/timezone-data ) |
795 |
- " |
796 |
- PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
797 |
-fi |
798 |
- |
799 |
-# Ignore tests whitelisted below |
800 |
-GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}" |
801 |
- |
802 |
-# The following tests fail due to the Gentoo build system and are thus |
803 |
-# executed but ignored: |
804 |
-XFAIL_TEST_LIST=( |
805 |
- # 9) Failures of unknown origin |
806 |
- tst-latepthread |
807 |
- |
808 |
- # buggy test, assumes /dev/ and /dev/null on a single filesystem |
809 |
- # 'mount --bind /dev/null /chroot/dev/null' breaks it. |
810 |
- # https://sourceware.org/PR25909 |
811 |
- tst-support_descriptors |
812 |
- |
813 |
- # Flaky test, known to fail occasionally: |
814 |
- # https://sourceware.org/PR19329 |
815 |
- # https://bugs.gentoo.org/719674#c12 |
816 |
- tst-stack4 |
817 |
-) |
818 |
- |
819 |
-# |
820 |
-# Small helper functions |
821 |
-# |
822 |
- |
823 |
-is_crosscompile() { |
824 |
- [[ ${CHOST} != ${CTARGET} ]] |
825 |
-} |
826 |
- |
827 |
-just_headers() { |
828 |
- is_crosscompile && use headers-only |
829 |
-} |
830 |
- |
831 |
-alt_prefix() { |
832 |
- is_crosscompile && echo /usr/${CTARGET} |
833 |
-} |
834 |
- |
835 |
-# This prefix is applicable to CHOST when building against this |
836 |
-# glibc. It is baked into the library at configure time. |
837 |
-host_eprefix() { |
838 |
- is_crosscompile || echo "${EPREFIX}" |
839 |
-} |
840 |
- |
841 |
-# This prefix is applicable to CBUILD when building against this |
842 |
-# glibc. It determines the destination path at install time. |
843 |
-build_eprefix() { |
844 |
- is_crosscompile && echo "${EPREFIX}" |
845 |
-} |
846 |
- |
847 |
-# We need to be able to set alternative headers for compiling for non-native |
848 |
-# platform. Will also become useful for testing kernel-headers without screwing |
849 |
-# up the whole system. |
850 |
-alt_headers() { |
851 |
- echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
852 |
-} |
853 |
- |
854 |
-alt_build_headers() { |
855 |
- if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
856 |
- ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)" |
857 |
- if tc-is-cross-compiler ; then |
858 |
- ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
859 |
- if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
860 |
- local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
861 |
- ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
862 |
- fi |
863 |
- fi |
864 |
- fi |
865 |
- echo "${ALT_BUILD_HEADERS}" |
866 |
-} |
867 |
- |
868 |
-alt_libdir() { |
869 |
- echo $(alt_prefix)/$(get_libdir) |
870 |
-} |
871 |
-alt_usrlibdir() { |
872 |
- echo $(alt_prefix)/usr/$(get_libdir) |
873 |
-} |
874 |
- |
875 |
-builddir() { |
876 |
- echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
877 |
-} |
878 |
- |
879 |
-do_compile_test() { |
880 |
- local ret save_cflags=${CFLAGS} |
881 |
- CFLAGS+=" $1" |
882 |
- shift |
883 |
- |
884 |
- pushd "${T}" >/dev/null |
885 |
- |
886 |
- rm -f glibc-test* |
887 |
- printf '%b' "$*" > glibc-test.c |
888 |
- |
889 |
- # Most of the time CC is already set, but not in early sanity checks. |
890 |
- nonfatal emake glibc-test CC="${CC-$(tc-getCC ${CTARGET})}" |
891 |
- ret=$? |
892 |
- |
893 |
- popd >/dev/null |
894 |
- |
895 |
- CFLAGS=${save_cflags} |
896 |
- return ${ret} |
897 |
-} |
898 |
- |
899 |
-do_run_test() { |
900 |
- local ret |
901 |
- |
902 |
- if [[ ${MERGE_TYPE} == "binary" ]] ; then |
903 |
- # ignore build failures when installing a binary package #324685 |
904 |
- do_compile_test "" "$@" 2>/dev/null || return 0 |
905 |
- else |
906 |
- if ! do_compile_test "" "$@" ; then |
907 |
- ewarn "Simple build failed ... assuming this is desired #324685" |
908 |
- return 0 |
909 |
- fi |
910 |
- fi |
911 |
- |
912 |
- pushd "${T}" >/dev/null |
913 |
- |
914 |
- ./glibc-test |
915 |
- ret=$? |
916 |
- rm -f glibc-test* |
917 |
- |
918 |
- popd >/dev/null |
919 |
- |
920 |
- return ${ret} |
921 |
-} |
922 |
- |
923 |
-setup_target_flags() { |
924 |
- # This largely mucks with compiler flags. None of which should matter |
925 |
- # when building up just the headers. |
926 |
- just_headers && return 0 |
927 |
- |
928 |
- case $(tc-arch) in |
929 |
- x86) |
930 |
- # -march needed for #185404 #199334 |
931 |
- # TODO: When creating the first glibc cross-compile, this test will |
932 |
- # always fail as it does a full link which in turn requires glibc. |
933 |
- # Probably also applies when changing multilib profile settings (e.g. |
934 |
- # enabling x86 when the profile was amd64-only previously). |
935 |
- # We could change main to _start and pass -nostdlib here so that we |
936 |
- # only test the gcc code compilation. Or we could do a compile and |
937 |
- # then look for the symbol via scanelf. |
938 |
- if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n'; then |
939 |
- local t=${CTARGET_OPT:-${CTARGET}} |
940 |
- t=${t%%-*} |
941 |
- filter-flags '-march=*' |
942 |
- export CFLAGS="-march=${t} ${CFLAGS}" |
943 |
- einfo "Auto adding -march=${t} to CFLAGS #185404" |
944 |
- fi |
945 |
- ;; |
946 |
- amd64) |
947 |
- # -march needed for #185404 #199334 |
948 |
- # TODO: See cross-compile issues listed above for x86. |
949 |
- [[ ${ABI} == x86 ]] && |
950 |
- if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n'; then |
951 |
- local t=${CTARGET_OPT:-${CTARGET}} |
952 |
- t=${t%%-*} |
953 |
- # Normally the target is x86_64-xxx, so turn that into the -march that |
954 |
- # gcc actually accepts. #528708 |
955 |
- [[ ${t} == "x86_64" ]] && t="x86-64" |
956 |
- filter-flags '-march=*' |
957 |
- # ugly, ugly, ugly. ugly. |
958 |
- CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
959 |
- export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
960 |
- einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})" |
961 |
- fi |
962 |
- ;; |
963 |
- mips) |
964 |
- # The mips abi cannot support the GNU style hashes. #233233 |
965 |
- filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
966 |
- ;; |
967 |
- ppc) |
968 |
- # Many arch-specific implementations do not work on ppc with |
969 |
- # cache-block not equal to 128 bytes. This breaks memset: |
970 |
- # https://sourceware.org/PR26522 |
971 |
- # https://bugs.gentoo.org/737996 |
972 |
- # Use default -mcpu=. For ppc it means non-multiarch setup. |
973 |
- filter-flags '-mcpu=*' |
974 |
- ;; |
975 |
- sparc) |
976 |
- # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
977 |
- filter-flags "-fcall-used-g7" |
978 |
- append-flags "-fcall-used-g6" |
979 |
- |
980 |
- local cpu |
981 |
- case ${CTARGET} in |
982 |
- sparc64-*) |
983 |
- cpu="sparc64" |
984 |
- case $(get-flag mcpu) in |
985 |
- v9) |
986 |
- # We need to force at least v9a because the base build doesn't |
987 |
- # work with just v9. |
988 |
- # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
989 |
- append-flags "-Wa,-xarch=v9a" |
990 |
- ;; |
991 |
- esac |
992 |
- ;; |
993 |
- sparc-*) |
994 |
- case $(get-flag mcpu) in |
995 |
- v8|supersparc|hypersparc|leon|leon3) |
996 |
- cpu="sparcv8" |
997 |
- ;; |
998 |
- *) |
999 |
- cpu="sparcv9" |
1000 |
- ;; |
1001 |
- esac |
1002 |
- ;; |
1003 |
- esac |
1004 |
- [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
1005 |
- ;; |
1006 |
- esac |
1007 |
-} |
1008 |
- |
1009 |
-setup_flags() { |
1010 |
- # Make sure host make.conf doesn't pollute us |
1011 |
- if is_crosscompile || tc-is-cross-compiler ; then |
1012 |
- CHOST=${CTARGET} strip-unsupported-flags |
1013 |
- fi |
1014 |
- |
1015 |
- # Store our CFLAGS because it's changed depending on which CTARGET |
1016 |
- # we are building when pulling glibc on a multilib profile |
1017 |
- CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
1018 |
- CFLAGS=${CFLAGS_BASE} |
1019 |
- CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
1020 |
- CXXFLAGS=${CXXFLAGS_BASE} |
1021 |
- ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
1022 |
- ASFLAGS=${ASFLAGS_BASE} |
1023 |
- |
1024 |
- # Allow users to explicitly avoid flag sanitization via |
1025 |
- # USE=custom-cflags. |
1026 |
- if ! use custom-cflags; then |
1027 |
- # Over-zealous CFLAGS can often cause problems. What may work for one |
1028 |
- # person may not work for another. To avoid a large influx of bugs |
1029 |
- # relating to failed builds, we strip most CFLAGS out to ensure as few |
1030 |
- # problems as possible. |
1031 |
- strip-flags |
1032 |
- # Lock glibc at -O2; we want to be conservative here. |
1033 |
- filter-flags '-O?' |
1034 |
- append-flags -O2 |
1035 |
- fi |
1036 |
- strip-unsupported-flags |
1037 |
- filter-flags -m32 -m64 '-mabi=*' |
1038 |
- |
1039 |
- # glibc aborts if rpath is set by LDFLAGS |
1040 |
- filter-ldflags '-Wl,-rpath=*' |
1041 |
- |
1042 |
- # #492892 |
1043 |
- filter-flags -frecord-gcc-switches |
1044 |
- |
1045 |
- unset CBUILD_OPT CTARGET_OPT |
1046 |
- if use multilib ; then |
1047 |
- CTARGET_OPT=$(get_abi_CTARGET) |
1048 |
- [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
1049 |
- fi |
1050 |
- |
1051 |
- setup_target_flags |
1052 |
- |
1053 |
- if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
1054 |
- CBUILD_OPT=${CTARGET_OPT} |
1055 |
- fi |
1056 |
- |
1057 |
- # glibc's headers disallow -O0 and fail at build time: |
1058 |
- # include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization" |
1059 |
- replace-flags -O0 -O1 |
1060 |
- |
1061 |
- filter-flags '-fstack-protector*' |
1062 |
-} |
1063 |
- |
1064 |
-want_tls() { |
1065 |
- # Archs that can use TLS (Thread Local Storage) |
1066 |
- case $(tc-arch) in |
1067 |
- x86) |
1068 |
- # requires i486 or better #106556 |
1069 |
- [[ ${CTARGET} == i[4567]86* ]] && return 0 |
1070 |
- return 1 |
1071 |
- ;; |
1072 |
- esac |
1073 |
- return 0 |
1074 |
-} |
1075 |
- |
1076 |
-want__thread() { |
1077 |
- want_tls || return 1 |
1078 |
- |
1079 |
- # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
1080 |
- [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
1081 |
- |
1082 |
- [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
1083 |
- |
1084 |
- # only test gcc -- can't test linking yet |
1085 |
- tc-has-tls -c ${CTARGET} |
1086 |
- WANT__THREAD=$? |
1087 |
- |
1088 |
- return ${WANT__THREAD} |
1089 |
-} |
1090 |
- |
1091 |
-use_multiarch() { |
1092 |
- # Allow user to disable runtime arch detection in multilib. |
1093 |
- use multiarch || return 1 |
1094 |
- # Make sure binutils is new enough to support indirect functions, |
1095 |
- # #336792. This funky sed supports gold and bfd linkers. |
1096 |
- local bver nver |
1097 |
- bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
1098 |
- case $(tc-arch ${CTARGET}) in |
1099 |
- amd64|x86) nver="2.20" ;; |
1100 |
- arm) nver="2.22" ;; |
1101 |
- hppa) nver="2.23" ;; |
1102 |
- ppc|ppc64) nver="2.20" ;; |
1103 |
- # ifunc support was added in 2.23, but glibc also needs |
1104 |
- # machinemode which is in 2.24. |
1105 |
- s390) nver="2.24" ;; |
1106 |
- sparc) nver="2.21" ;; |
1107 |
- *) return 1 ;; |
1108 |
- esac |
1109 |
- ver_test ${bver} -ge ${nver} |
1110 |
-} |
1111 |
- |
1112 |
-# Setup toolchain variables that had historically been defined in the |
1113 |
-# profiles for these archs. |
1114 |
-setup_env() { |
1115 |
- # silly users |
1116 |
- unset LD_RUN_PATH |
1117 |
- unset LD_ASSUME_KERNEL |
1118 |
- |
1119 |
- if is_crosscompile || tc-is-cross-compiler ; then |
1120 |
- multilib_env ${CTARGET_OPT:-${CTARGET}} |
1121 |
- |
1122 |
- if ! use multilib ; then |
1123 |
- MULTILIB_ABIS=${DEFAULT_ABI} |
1124 |
- else |
1125 |
- MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
1126 |
- fi |
1127 |
- |
1128 |
- # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
1129 |
- # and fall back on CFLAGS. |
1130 |
- local VAR=CFLAGS_${CTARGET//[-.]/_} |
1131 |
- CFLAGS=${!VAR-${CFLAGS}} |
1132 |
- einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
1133 |
- fi |
1134 |
- |
1135 |
- setup_flags |
1136 |
- |
1137 |
- export ABI=${ABI:-${DEFAULT_ABI:-default}} |
1138 |
- |
1139 |
- if just_headers ; then |
1140 |
- # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
1141 |
- # At this bootstrap stage we have only binutils for |
1142 |
- # target but not compiler yet. |
1143 |
- einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
1144 |
- return 0 |
1145 |
- fi |
1146 |
- local VAR=CFLAGS_${ABI} |
1147 |
- # We need to export CFLAGS with abi information in them because glibc's |
1148 |
- # configure script checks CFLAGS for some targets (like mips). Keep |
1149 |
- # around the original clean value to avoid appending multiple ABIs on |
1150 |
- # top of each other. |
1151 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET})} |
1152 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
1153 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
1154 |
-} |
1155 |
- |
1156 |
-foreach_abi() { |
1157 |
- setup_env |
1158 |
- |
1159 |
- local ret=0 |
1160 |
- local abilist="" |
1161 |
- if use multilib ; then |
1162 |
- abilist=$(get_install_abis) |
1163 |
- else |
1164 |
- abilist=${DEFAULT_ABI} |
1165 |
- fi |
1166 |
- local -x ABI |
1167 |
- for ABI in ${abilist:-default} ; do |
1168 |
- setup_env |
1169 |
- einfo "Running $1 for ABI ${ABI}" |
1170 |
- $1 |
1171 |
- : $(( ret |= $? )) |
1172 |
- done |
1173 |
- return ${ret} |
1174 |
-} |
1175 |
- |
1176 |
-glibc_banner() { |
1177 |
- local b="Gentoo ${PVR}" |
1178 |
- [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
1179 |
- echo "${b}" |
1180 |
-} |
1181 |
- |
1182 |
-# The following Kernel version handling functions are mostly copied from portage |
1183 |
-# source. It's better not to use linux-info.eclass here since a) it adds too |
1184 |
-# much magic, see bug 326693 for some of the arguments, and b) some of the |
1185 |
-# functions are just not provided. |
1186 |
- |
1187 |
-g_get_running_KV() { |
1188 |
- uname -r |
1189 |
- return $? |
1190 |
-} |
1191 |
- |
1192 |
-g_KV_major() { |
1193 |
- [[ -z $1 ]] && return 1 |
1194 |
- local KV=$@ |
1195 |
- echo "${KV%%.*}" |
1196 |
-} |
1197 |
- |
1198 |
-g_KV_minor() { |
1199 |
- [[ -z $1 ]] && return 1 |
1200 |
- local KV=$@ |
1201 |
- KV=${KV#*.} |
1202 |
- echo "${KV%%.*}" |
1203 |
-} |
1204 |
- |
1205 |
-g_KV_micro() { |
1206 |
- [[ -z $1 ]] && return 1 |
1207 |
- local KV=$@ |
1208 |
- KV=${KV#*.*.} |
1209 |
- echo "${KV%%[^[:digit:]]*}" |
1210 |
-} |
1211 |
- |
1212 |
-g_KV_to_int() { |
1213 |
- [[ -z $1 ]] && return 1 |
1214 |
- local KV_MAJOR=$(g_KV_major "$1") |
1215 |
- local KV_MINOR=$(g_KV_minor "$1") |
1216 |
- local KV_MICRO=$(g_KV_micro "$1") |
1217 |
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
1218 |
- |
1219 |
- # We make version 2.2.0 the minimum version we will handle as |
1220 |
- # a sanity check ... if its less, we fail ... |
1221 |
- if [[ ${KV_int} -ge 131584 ]] ; then |
1222 |
- echo "${KV_int}" |
1223 |
- return 0 |
1224 |
- fi |
1225 |
- return 1 |
1226 |
-} |
1227 |
- |
1228 |
-g_int_to_KV() { |
1229 |
- local version=$1 major minor micro |
1230 |
- major=$((version / 65536)) |
1231 |
- minor=$(((version % 65536) / 256)) |
1232 |
- micro=$((version % 256)) |
1233 |
- echo ${major}.${minor}.${micro} |
1234 |
-} |
1235 |
- |
1236 |
-eend_KV() { |
1237 |
- [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
1238 |
- eend $? |
1239 |
-} |
1240 |
- |
1241 |
-get_kheader_version() { |
1242 |
- printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
1243 |
- $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \ |
1244 |
- tail -n 1 |
1245 |
-} |
1246 |
- |
1247 |
-# We collect all sanity checks here. Consistency is not guranteed between |
1248 |
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
1249 |
-# src_unpack. |
1250 |
-sanity_prechecks() { |
1251 |
- # Prevent native builds from downgrading |
1252 |
- if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
1253 |
- [[ -z ${ROOT} ]] && \ |
1254 |
- [[ ${CBUILD} == ${CHOST} ]] && \ |
1255 |
- [[ ${CHOST} == ${CTARGET} ]] ; then |
1256 |
- |
1257 |
- # The high rev # is to allow people to downgrade between -r# |
1258 |
- # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
1259 |
- # should be fine. Hopefully we never actually use a r# this |
1260 |
- # high. |
1261 |
- if has_version ">${CATEGORY}/${P}-r10000" ; then |
1262 |
- eerror "Sanity check to keep you from breaking your system:" |
1263 |
- eerror " Downgrading glibc is not supported and a sure way to destruction." |
1264 |
- [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
1265 |
- fi |
1266 |
- |
1267 |
- if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
1268 |
- eerror "Your old kernel is broken. You need to update it to a newer" |
1269 |
- eerror "version as syscall(<bignum>) will break. See bug 279260." |
1270 |
- die "Old and broken kernel." |
1271 |
- fi |
1272 |
- fi |
1273 |
- |
1274 |
- # Users have had a chance to phase themselves, time to give em the boot |
1275 |
- if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
1276 |
- eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
1277 |
- eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
1278 |
- die "Lazy upgrader detected" |
1279 |
- fi |
1280 |
- |
1281 |
- if [[ ${CTARGET} == i386-* ]] ; then |
1282 |
- eerror "i386 CHOSTs are no longer supported." |
1283 |
- eerror "Chances are you don't actually want/need i386." |
1284 |
- eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
1285 |
- die "Please fix your CHOST" |
1286 |
- fi |
1287 |
- |
1288 |
- if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
1289 |
- ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
1290 |
- ewarn "This will result in a 50% performance penalty when running with a 32bit" |
1291 |
- ewarn "hypervisor, which is probably not what you want." |
1292 |
- fi |
1293 |
- |
1294 |
- # Check for sanity of /etc/nsswitch.conf |
1295 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
1296 |
- local entry |
1297 |
- for entry in passwd group shadow; do |
1298 |
- if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
1299 |
- eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
1300 |
- eerror "Please make sure you have 'files' entries for" |
1301 |
- eerror "'passwd:', 'group:' and 'shadow:' databases." |
1302 |
- eerror "For more details see:" |
1303 |
- eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
1304 |
- die "nsswitch.conf has no 'files' provider in '${entry}'." |
1305 |
- fi |
1306 |
- done |
1307 |
- fi |
1308 |
- |
1309 |
- # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
1310 |
- # we test for... |
1311 |
- if ! is_crosscompile ; then |
1312 |
- if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
1313 |
- ebegin "Checking that IA32 emulation is enabled in the running kernel" |
1314 |
- echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
1315 |
- local STAT |
1316 |
- if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
1317 |
- "${T}/check-ia32-emulation.elf32" |
1318 |
- STAT=$? |
1319 |
- else |
1320 |
- # Don't fail here to allow single->multi ABI switch |
1321 |
- # or recover from breakage like bug #646424 |
1322 |
- ewarn "Failed to compile the ABI test. Broken host glibc?" |
1323 |
- STAT=0 |
1324 |
- fi |
1325 |
- rm -f "${T}/check-ia32-emulation.elf32" |
1326 |
- eend $STAT |
1327 |
- [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
1328 |
- fi |
1329 |
- |
1330 |
- fi |
1331 |
- |
1332 |
- # When we actually have to compile something... |
1333 |
- if ! just_headers ; then |
1334 |
- ebegin "Checking gcc for __thread support" |
1335 |
- if ! eend $(want__thread ; echo $?) ; then |
1336 |
- echo |
1337 |
- eerror "Could not find a gcc that supports the __thread directive!" |
1338 |
- eerror "Please update your binutils/gcc and try again." |
1339 |
- die "No __thread support in gcc!" |
1340 |
- fi |
1341 |
- |
1342 |
- if [[ ${CTARGET} == *-linux* ]] ; then |
1343 |
- local run_kv build_kv want_kv |
1344 |
- |
1345 |
- run_kv=$(g_get_running_KV) |
1346 |
- build_kv=$(g_int_to_KV $(get_kheader_version)) |
1347 |
- want_kv=${MIN_KERN_VER} |
1348 |
- |
1349 |
- if ! is_crosscompile && ! tc-is-cross-compiler ; then |
1350 |
- # Building fails on an non-supporting kernel |
1351 |
- ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
1352 |
- if ! eend_KV ${run_kv} ${want_kv} ; then |
1353 |
- echo |
1354 |
- eerror "You need a kernel of at least ${want_kv}!" |
1355 |
- die "Kernel version too low!" |
1356 |
- fi |
1357 |
- fi |
1358 |
- |
1359 |
- ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
1360 |
- if ! eend_KV ${build_kv} ${want_kv} ; then |
1361 |
- echo |
1362 |
- eerror "You need linux-headers of at least ${want_kv}!" |
1363 |
- die "linux-headers version too low!" |
1364 |
- fi |
1365 |
- fi |
1366 |
- fi |
1367 |
-} |
1368 |
- |
1369 |
-# |
1370 |
-# the phases |
1371 |
-# |
1372 |
- |
1373 |
-# pkg_pretend |
1374 |
- |
1375 |
-pkg_pretend() { |
1376 |
- # All the checks... |
1377 |
- einfo "Checking general environment sanity." |
1378 |
- sanity_prechecks |
1379 |
-} |
1380 |
- |
1381 |
-pkg_setup() { |
1382 |
- # see bug 682570 |
1383 |
- [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup |
1384 |
-} |
1385 |
- |
1386 |
-# src_unpack |
1387 |
- |
1388 |
-src_unpack() { |
1389 |
- # Consistency is not guaranteed between pkg_ and src_ ... |
1390 |
- sanity_prechecks |
1391 |
- |
1392 |
- use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
1393 |
- |
1394 |
- setup_env |
1395 |
- |
1396 |
- if [[ ${PV} == 9999* ]] ; then |
1397 |
- EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git" |
1398 |
- EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git |
1399 |
- git-r3_src_unpack |
1400 |
- mv patches-git/9999 patches || die |
1401 |
- |
1402 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
1403 |
- EGIT_CHECKOUT_DIR=${S} |
1404 |
- git-r3_src_unpack |
1405 |
- else |
1406 |
- unpack ${P}.tar.xz |
1407 |
- |
1408 |
- cd "${WORKDIR}" || die |
1409 |
- unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz |
1410 |
- fi |
1411 |
- |
1412 |
- cd "${WORKDIR}" || die |
1413 |
- unpack locale-gen-${LOCALE_GEN_VER}.tar.gz |
1414 |
- use riscv && unpack backport-rv32.txz |
1415 |
-} |
1416 |
- |
1417 |
-src_prepare() { |
1418 |
- local patchsetname |
1419 |
- if ! use vanilla ; then |
1420 |
- if [[ ${PV} == 9999* ]] ; then |
1421 |
- patchsetname="from git master" |
1422 |
- else |
1423 |
- patchsetname="${RELEASE_VER}-${PATCH_VER}" |
1424 |
- fi |
1425 |
- elog "Applying Gentoo Glibc Patchset ${patchsetname}" |
1426 |
- eapply "${WORKDIR}"/patches |
1427 |
- einfo "Done." |
1428 |
- |
1429 |
- if use riscv ; then |
1430 |
- elog "Adding rv32 backport patchset for glibc-2.32 (experimental)" |
1431 |
- eapply "${WORKDIR}"/backport-rv32 |
1432 |
- einfo "Done." |
1433 |
- fi |
1434 |
- fi |
1435 |
- |
1436 |
- default |
1437 |
- |
1438 |
- gnuconfig_update |
1439 |
- |
1440 |
- cd "${WORKDIR}" |
1441 |
- find . -name configure -exec touch {} + |
1442 |
- |
1443 |
- # move the external locale-gen to its old place |
1444 |
- mkdir extra || die |
1445 |
- mv locale-gen-${LOCALE_GEN_VER} extra/locale || die |
1446 |
- |
1447 |
- eprefixify extra/locale/locale-gen |
1448 |
- |
1449 |
- # Fix permissions on some of the scripts. |
1450 |
- chmod u+x "${S}"/scripts/*.sh |
1451 |
- |
1452 |
- cd "${S}" |
1453 |
-} |
1454 |
- |
1455 |
-glibc_do_configure() { |
1456 |
- # Glibc does not work with gold (for various reasons) #269274. |
1457 |
- tc-ld-disable-gold |
1458 |
- |
1459 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
1460 |
- # we accumulate crap across abis |
1461 |
- unset CXX |
1462 |
- |
1463 |
- einfo "Configuring glibc for nptl" |
1464 |
- |
1465 |
- if use doc ; then |
1466 |
- export MAKEINFO=makeinfo |
1467 |
- else |
1468 |
- export MAKEINFO=/dev/null |
1469 |
- fi |
1470 |
- |
1471 |
- local v |
1472 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do |
1473 |
- einfo " $(printf '%15s' ${v}:) ${!v}" |
1474 |
- done |
1475 |
- |
1476 |
- # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
1477 |
- # To build .S (assembly) files with the same ABI-specific flags |
1478 |
- # upstream currently recommends adding CFLAGS to CC/CXX: |
1479 |
- # https://sourceware.org/PR23273 |
1480 |
- # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
1481 |
- # and breaks multiarch support. See 659030#c3 for an example. |
1482 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
1483 |
- export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
1484 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
1485 |
- |
1486 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
1487 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
1488 |
- |
1489 |
- if is_crosscompile; then |
1490 |
- # Assume worst-case bootstrap: glibc is buil first time |
1491 |
- # when ${CTARGET}-g++ is not available yet. We avoid |
1492 |
- # building auxiliary programs that require C++: bug #683074 |
1493 |
- # It should not affect final result. |
1494 |
- export libc_cv_cxx_link_ok=no |
1495 |
- # The line above has the same effect. We set CXX explicitly |
1496 |
- # to make build logs less confusing. |
1497 |
- export CXX= |
1498 |
- fi |
1499 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
1500 |
- |
1501 |
- # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure |
1502 |
- # can't detect them automatically due to ${CHOST} mismatch and fallbacks |
1503 |
- # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup(). |
1504 |
- export NM="$(tc-getNM ${CTARGET})" |
1505 |
- export READELF="$(tc-getREADELF ${CTARGET})" |
1506 |
- einfo " $(printf '%15s' 'Manual NM:') ${NM}" |
1507 |
- einfo " $(printf '%15s' 'Manual READELF:') ${READELF}" |
1508 |
- |
1509 |
- echo |
1510 |
- |
1511 |
- local myconf=() |
1512 |
- |
1513 |
- case ${CTARGET} in |
1514 |
- m68k*) |
1515 |
- # setjmp() is not compatible with stack protection: |
1516 |
- # https://sourceware.org/PR24202 |
1517 |
- myconf+=( --enable-stack-protector=no ) |
1518 |
- ;; |
1519 |
- powerpc-*) |
1520 |
- # Currently gcc on powerpc32 generates invalid code for |
1521 |
- # __builtin_return_address(0) calls. Normally programs |
1522 |
- # don't do that but malloc hooks in glibc do: |
1523 |
- # https://gcc.gnu.org/PR81996 |
1524 |
- # https://bugs.gentoo.org/629054 |
1525 |
- myconf+=( --enable-stack-protector=no ) |
1526 |
- ;; |
1527 |
- *) |
1528 |
- # Use '=strong' instead of '=all' to protect only functions |
1529 |
- # worth protecting from stack smashes. |
1530 |
- # '=all' is also known to have a problem in IFUNC resolution |
1531 |
- # tests: https://sourceware.org/PR25680, bug #712356. |
1532 |
- myconf+=( --enable-stack-protector=$(usex ssp strong no) ) |
1533 |
- ;; |
1534 |
- esac |
1535 |
- myconf+=( --enable-stackguard-randomization ) |
1536 |
- |
1537 |
- # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
1538 |
- # is not robust enough to detect proper support: |
1539 |
- # https://bugs.gentoo.org/641216 |
1540 |
- # https://sourceware.org/PR22634#c0 |
1541 |
- case $(tc-arch ${CTARGET}) in |
1542 |
- # Keep whitelist of targets where autodetection mostly works. |
1543 |
- amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
1544 |
- # Blacklist everywhere else |
1545 |
- *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
1546 |
- esac |
1547 |
- |
1548 |
- # Enable Intel Control-flow Enforcement Technology on amd64 if requested |
1549 |
- case ${CTARGET} in |
1550 |
- x86_64-*) myconf+=( $(use_enable cet) ) ;; |
1551 |
- *) ;; |
1552 |
- esac |
1553 |
- |
1554 |
- [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
1555 |
- |
1556 |
- myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
1557 |
- |
1558 |
- # Since SELinux support is only required for nscd, only enable it if: |
1559 |
- # 1. USE selinux |
1560 |
- # 2. only for the primary ABI on multilib systems |
1561 |
- # 3. Not a crosscompile |
1562 |
- if ! is_crosscompile && use selinux ; then |
1563 |
- if use multilib ; then |
1564 |
- if is_final_abi ; then |
1565 |
- myconf+=( --with-selinux ) |
1566 |
- else |
1567 |
- myconf+=( --without-selinux ) |
1568 |
- fi |
1569 |
- else |
1570 |
- myconf+=( --with-selinux ) |
1571 |
- fi |
1572 |
- else |
1573 |
- myconf+=( --without-selinux ) |
1574 |
- fi |
1575 |
- |
1576 |
- # Force a few tests where we always know the answer but |
1577 |
- # configure is incapable of finding it. |
1578 |
- if is_crosscompile ; then |
1579 |
- export \ |
1580 |
- libc_cv_c_cleanup=yes \ |
1581 |
- libc_cv_forced_unwind=yes |
1582 |
- fi |
1583 |
- |
1584 |
- myconf+=( |
1585 |
- --without-cvs |
1586 |
- --disable-werror |
1587 |
- --enable-bind-now |
1588 |
- --build=${CBUILD_OPT:-${CBUILD}} |
1589 |
- --host=${CTARGET_OPT:-${CTARGET}} |
1590 |
- $(use_enable profile) |
1591 |
- $(use_with gd) |
1592 |
- --with-headers=$(build_eprefix)$(alt_build_headers) |
1593 |
- --prefix="$(host_eprefix)/usr" |
1594 |
- --sysconfdir="$(host_eprefix)/etc" |
1595 |
- --localstatedir="$(host_eprefix)/var" |
1596 |
- --libdir='$(prefix)'/$(get_libdir) |
1597 |
- --mandir='$(prefix)'/share/man |
1598 |
- --infodir='$(prefix)'/share/info |
1599 |
- --libexecdir='$(libdir)'/misc/glibc |
1600 |
- --with-bugurl=https://bugs.gentoo.org/ |
1601 |
- --with-pkgversion="$(glibc_banner)" |
1602 |
- $(use_enable crypt) |
1603 |
- $(use_multiarch || echo --disable-multi-arch) |
1604 |
- $(use_enable static-pie) |
1605 |
- $(use_enable systemtap) |
1606 |
- $(use_enable nscd) |
1607 |
- ${EXTRA_ECONF} |
1608 |
- ) |
1609 |
- |
1610 |
- # We rely on sys-libs/timezone-data for timezone tools normally. |
1611 |
- myconf+=( $(use_enable vanilla timezone-tools) ) |
1612 |
- |
1613 |
- # These libs don't have configure flags. |
1614 |
- ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) |
1615 |
- ac_cv_lib_cap_cap_init=$(usex caps || echo no) |
1616 |
- |
1617 |
- # There is no configure option for this and we need to export it |
1618 |
- # since the glibc build will re-run configure on itself |
1619 |
- export libc_cv_rootsbindir="$(host_eprefix)/sbin" |
1620 |
- export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)" |
1621 |
- |
1622 |
- # We take care of patching our binutils to use both hash styles, |
1623 |
- # and many people like to force gnu hash style only, so disable |
1624 |
- # this overriding check. #347761 |
1625 |
- export libc_cv_hashstyle=no |
1626 |
- |
1627 |
- local builddir=$(builddir nptl) |
1628 |
- mkdir -p "${builddir}" |
1629 |
- cd "${builddir}" |
1630 |
- set -- "${S}"/configure "${myconf[@]}" |
1631 |
- echo "$@" |
1632 |
- "$@" || die "failed to configure glibc" |
1633 |
- |
1634 |
- # ia64 static cross-compilers are a pita in so much that they |
1635 |
- # can't produce static ELFs (as the libgcc.a is broken). so |
1636 |
- # disable building of the programs for those targets if it |
1637 |
- # doesn't work. |
1638 |
- # XXX: We could turn this into a compiler test, but ia64 is |
1639 |
- # the only one that matters, so this should be fine for now. |
1640 |
- if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
1641 |
- sed -i '1i+link-static = touch $@' config.make |
1642 |
- fi |
1643 |
- |
1644 |
- # If we're trying to migrate between ABI sets, we need |
1645 |
- # to lie and use a local copy of gcc. Like if the system |
1646 |
- # is built with MULTILIB_ABIS="amd64 x86" but we want to |
1647 |
- # add x32 to it, gcc/glibc don't yet support x32. |
1648 |
- # |
1649 |
- if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
1650 |
- echo 'main(){}' > "${T}"/test.c |
1651 |
- if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
1652 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1653 |
- fi |
1654 |
- fi |
1655 |
-} |
1656 |
- |
1657 |
-glibc_headers_configure() { |
1658 |
- export ABI=default |
1659 |
- |
1660 |
- local builddir=$(builddir "headers") |
1661 |
- mkdir -p "${builddir}" |
1662 |
- cd "${builddir}" |
1663 |
- |
1664 |
- # if we don't have a compiler yet, we can't really test it now ... |
1665 |
- # hopefully they don't affect header generation, so let's hope for |
1666 |
- # the best here ... |
1667 |
- local v vars=( |
1668 |
- ac_cv_header_cpuid_h=yes |
1669 |
- libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
1670 |
- libc_cv_asm_cfi_directives=yes |
1671 |
- libc_cv_broken_visibility_attribute=no |
1672 |
- libc_cv_c_cleanup=yes |
1673 |
- libc_cv_compiler_powerpc64le_binary128_ok=yes |
1674 |
- libc_cv_forced_unwind=yes |
1675 |
- libc_cv_gcc___thread=yes |
1676 |
- libc_cv_mlong_double_128=yes |
1677 |
- libc_cv_mlong_double_128ibm=yes |
1678 |
- libc_cv_ppc_machine=yes |
1679 |
- libc_cv_ppc_rel16=yes |
1680 |
- libc_cv_predef_fortify_source=no |
1681 |
- libc_cv_target_power8_ok=yes |
1682 |
- libc_cv_visibility_attribute=yes |
1683 |
- libc_cv_z_combreloc=yes |
1684 |
- libc_cv_z_execstack=yes |
1685 |
- libc_cv_z_initfirst=yes |
1686 |
- libc_cv_z_nodelete=yes |
1687 |
- libc_cv_z_nodlopen=yes |
1688 |
- libc_cv_z_relro=yes |
1689 |
- libc_mips_abi=${ABI} |
1690 |
- libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
1691 |
- # These libs don't have configure flags. |
1692 |
- ac_cv_lib_audit_audit_log_user_avc_message=no |
1693 |
- ac_cv_lib_cap_cap_init=no |
1694 |
- ) |
1695 |
- |
1696 |
- einfo "Forcing cached settings:" |
1697 |
- for v in "${vars[@]}" ; do |
1698 |
- einfo " ${v}" |
1699 |
- export ${v} |
1700 |
- done |
1701 |
- |
1702 |
- local headers_only_arch_CPPFLAGS=() |
1703 |
- |
1704 |
- # Blow away some random CC settings that screw things up. #550192 |
1705 |
- if [[ -d ${S}/sysdeps/mips ]]; then |
1706 |
- pushd "${S}"/sysdeps/mips >/dev/null |
1707 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
1708 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
1709 |
- |
1710 |
- # Force the mips ABI to the default. This is OK because the set of |
1711 |
- # installed headers in this phase is the same between the 3 ABIs. |
1712 |
- # If this ever changes, this hack will break, but that's unlikely |
1713 |
- # as glibc discourages that behavior. |
1714 |
- # https://crbug.com/647033 |
1715 |
- sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
1716 |
- |
1717 |
- popd >/dev/null |
1718 |
- fi |
1719 |
- |
1720 |
- case ${CTARGET} in |
1721 |
- riscv*) |
1722 |
- # RISC-V interrogates the compiler to determine which target to |
1723 |
- # build. If building the headers then we don't strictly need a |
1724 |
- # RISC-V compiler, so the built-in definitions that are provided |
1725 |
- # along with all RISC-V compiler might not exist. This causes |
1726 |
- # glibc's RISC-V preconfigure script to blow up. Since we're just |
1727 |
- # building the headers any value will actually work here, so just |
1728 |
- # pick the standard one (rv64g/lp64d) to make the build scripts |
1729 |
- # happy for now -- the headers are all the same anyway so it |
1730 |
- # doesn't matter. |
1731 |
- headers_only_arch_CPPFLAGS+=( |
1732 |
- -D__riscv_xlen=64 |
1733 |
- -D__riscv_flen=64 |
1734 |
- -D__riscv_float_abi_double=1 |
1735 |
- -D__riscv_atomic=1 |
1736 |
- ) ;; |
1737 |
- esac |
1738 |
- |
1739 |
- local myconf=() |
1740 |
- myconf+=( |
1741 |
- --disable-sanity-checks |
1742 |
- --enable-hacker-mode |
1743 |
- --without-cvs |
1744 |
- --disable-werror |
1745 |
- --enable-bind-now |
1746 |
- --build=${CBUILD_OPT:-${CBUILD}} |
1747 |
- --host=${CTARGET_OPT:-${CTARGET}} |
1748 |
- --with-headers=$(build_eprefix)$(alt_build_headers) |
1749 |
- --prefix="$(host_eprefix)/usr" |
1750 |
- ${EXTRA_ECONF} |
1751 |
- ) |
1752 |
- |
1753 |
- # Nothing is compiled here which would affect the headers for the target. |
1754 |
- # So forcing CC/CFLAGS is sane. |
1755 |
- local headers_only_CC=$(tc-getBUILD_CC) |
1756 |
- local headers_only_CFLAGS="-O1 -pipe" |
1757 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
1758 |
- local headers_only_LDFLAGS="" |
1759 |
- set -- "${S}"/configure "${myconf[@]}" |
1760 |
- echo \ |
1761 |
- "CC=${headers_only_CC}" \ |
1762 |
- "CFLAGS=${headers_only_CFLAGS}" \ |
1763 |
- "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
1764 |
- "LDFLAGS=${headers_only_LDFLAGS}" \ |
1765 |
- "$@" |
1766 |
- CC=${headers_only_CC} \ |
1767 |
- CFLAGS=${headers_only_CFLAGS} \ |
1768 |
- CPPFLAGS=${headers_only_CPPFLAGS} \ |
1769 |
- LDFLAGS="" \ |
1770 |
- "$@" || die "failed to configure glibc" |
1771 |
-} |
1772 |
- |
1773 |
-do_src_configure() { |
1774 |
- if just_headers ; then |
1775 |
- glibc_headers_configure |
1776 |
- else |
1777 |
- glibc_do_configure nptl |
1778 |
- fi |
1779 |
-} |
1780 |
- |
1781 |
-src_configure() { |
1782 |
- foreach_abi do_src_configure |
1783 |
-} |
1784 |
- |
1785 |
-do_src_compile() { |
1786 |
- emake -C "$(builddir nptl)" |
1787 |
-} |
1788 |
- |
1789 |
-src_compile() { |
1790 |
- if just_headers ; then |
1791 |
- return |
1792 |
- fi |
1793 |
- |
1794 |
- foreach_abi do_src_compile |
1795 |
-} |
1796 |
- |
1797 |
-glibc_src_test() { |
1798 |
- cd "$(builddir nptl)" |
1799 |
- |
1800 |
- local myxfailparams="" |
1801 |
- if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then |
1802 |
- for myt in ${XFAIL_TEST_LIST[@]} ; do |
1803 |
- myxfailparams+="test-xfail-${myt}=yes " |
1804 |
- done |
1805 |
- fi |
1806 |
- |
1807 |
- # sandbox does not understand unshare() and prevents |
1808 |
- # writes to /proc/, which makes many tests fail |
1809 |
- |
1810 |
- SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check |
1811 |
-} |
1812 |
- |
1813 |
-do_src_test() { |
1814 |
- local ret=0 |
1815 |
- |
1816 |
- glibc_src_test |
1817 |
- : $(( ret |= $? )) |
1818 |
- |
1819 |
- return ${ret} |
1820 |
-} |
1821 |
- |
1822 |
-src_test() { |
1823 |
- if just_headers ; then |
1824 |
- return |
1825 |
- fi |
1826 |
- |
1827 |
- # Give tests more time to complete. |
1828 |
- export TIMEOUTFACTOR=5 |
1829 |
- |
1830 |
- foreach_abi do_src_test || die "tests failed" |
1831 |
-} |
1832 |
- |
1833 |
-run_locale_gen() { |
1834 |
- # if the host locales.gen contains no entries, we'll install everything |
1835 |
- local root="$1" |
1836 |
- local inplace="" |
1837 |
- |
1838 |
- if [[ "${root}" == "--inplace-glibc" ]] ; then |
1839 |
- inplace="--inplace-glibc" |
1840 |
- root="$2" |
1841 |
- fi |
1842 |
- |
1843 |
- local locale_list="${root}/etc/locale.gen" |
1844 |
- |
1845 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
1846 |
- |
1847 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
1848 |
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
1849 |
- locale_list="${root}/usr/share/i18n/SUPPORTED" |
1850 |
- fi |
1851 |
- |
1852 |
- set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \ |
1853 |
- --destdir "${root}" |
1854 |
- echo "$@" |
1855 |
- "$@" |
1856 |
- |
1857 |
- popd >/dev/null |
1858 |
-} |
1859 |
- |
1860 |
-glibc_do_src_install() { |
1861 |
- local builddir=$(builddir nptl) |
1862 |
- cd "${builddir}" |
1863 |
- |
1864 |
- emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install |
1865 |
- |
1866 |
- # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
1867 |
- # which come without headers etc. Only needed for binary packages since the |
1868 |
- # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
1869 |
- find "${D}" -name "libnsl.a" -delete |
1870 |
- find "${D}" -name "libnsl.so" -delete |
1871 |
- |
1872 |
- # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
1873 |
- # to infer upstream version: |
1874 |
- # '#define VERSION "2.26.90"' -> '2.26.90' |
1875 |
- local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
1876 |
- |
1877 |
- # Avoid stripping binaries not targeted by ${CHOST}. Or else |
1878 |
- # ${CHOST}-strip would break binaries build for ${CTARGET}. |
1879 |
- is_crosscompile && dostrip -x / |
1880 |
- # gdb thread introspection relies on local libpthreas symbols. stripping breaks it |
1881 |
- # See Note [Disable automatic stripping] |
1882 |
- dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so |
1883 |
- |
1884 |
- if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
1885 |
- # Move versioned .a file out of libdir to evade portage QA checks |
1886 |
- # instead of using gen_usr_ldscript(). We fix ldscript as: |
1887 |
- # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
1888 |
- sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die |
1889 |
- dodir $(alt_usrlibdir)/${P} |
1890 |
- mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
1891 |
- fi |
1892 |
- |
1893 |
- # We'll take care of the cache ourselves |
1894 |
- rm -f "${ED}"/etc/ld.so.cache |
1895 |
- |
1896 |
- # Everything past this point just needs to be done once ... |
1897 |
- is_final_abi || return 0 |
1898 |
- |
1899 |
- # Make sure the non-native interp can be found on multilib systems even |
1900 |
- # if the main library set isn't installed into the right place. Maybe |
1901 |
- # we should query the active gcc for info instead of hardcoding it ? |
1902 |
- local i ldso_abi ldso_name |
1903 |
- local ldso_abi_list=( |
1904 |
- # x86 |
1905 |
- amd64 /lib64/ld-linux-x86-64.so.2 |
1906 |
- x32 /libx32/ld-linux-x32.so.2 |
1907 |
- x86 /lib/ld-linux.so.2 |
1908 |
- # mips |
1909 |
- o32 /lib/ld.so.1 |
1910 |
- n32 /lib32/ld.so.1 |
1911 |
- n64 /lib64/ld.so.1 |
1912 |
- # powerpc |
1913 |
- ppc /lib/ld.so.1 |
1914 |
- ppc64 /lib64/ld64.so.1 |
1915 |
- # riscv |
1916 |
- ilp32d /lib/ld-linux-riscv32-ilp32d.so.1 |
1917 |
- ilp32 /lib/ld-linux-riscv32-ilp32.so.1 |
1918 |
- lp64d /lib/ld-linux-riscv64-lp64d.so.1 |
1919 |
- lp64 /lib/ld-linux-riscv64-lp64.so.1 |
1920 |
- # s390 |
1921 |
- s390 /lib/ld.so.1 |
1922 |
- s390x /lib/ld64.so.1 |
1923 |
- # sparc |
1924 |
- sparc32 /lib/ld-linux.so.2 |
1925 |
- sparc64 /lib64/ld-linux.so.2 |
1926 |
- ) |
1927 |
- case $(tc-endian) in |
1928 |
- little) |
1929 |
- ldso_abi_list+=( |
1930 |
- # arm |
1931 |
- arm64 /lib/ld-linux-aarch64.so.1 |
1932 |
- ) |
1933 |
- ;; |
1934 |
- big) |
1935 |
- ldso_abi_list+=( |
1936 |
- # arm |
1937 |
- arm64 /lib/ld-linux-aarch64_be.so.1 |
1938 |
- ) |
1939 |
- ;; |
1940 |
- esac |
1941 |
- if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
1942 |
- dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
1943 |
- fi |
1944 |
- for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
1945 |
- ldso_abi=${ldso_abi_list[i]} |
1946 |
- has ${ldso_abi} $(get_install_abis) || continue |
1947 |
- |
1948 |
- ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
1949 |
- if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
1950 |
- dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
1951 |
- fi |
1952 |
- done |
1953 |
- |
1954 |
- # With devpts under Linux mounted properly, we do not need the pt_chown |
1955 |
- # binary to be setuid. This is because the default owners/perms will be |
1956 |
- # exactly what we want. |
1957 |
- if ! use suid ; then |
1958 |
- find "${ED}" -name pt_chown -exec chmod -s {} + |
1959 |
- fi |
1960 |
- |
1961 |
- ################################################################# |
1962 |
- # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
1963 |
- # Make sure we install some symlink hacks so that when we build |
1964 |
- # a 2nd stage cross-compiler, gcc finds the target system |
1965 |
- # headers correctly. See gcc/doc/gccinstall.info |
1966 |
- if is_crosscompile ; then |
1967 |
- # We need to make sure that /lib and /usr/lib always exists. |
1968 |
- # gcc likes to use relative paths to get to its multilibs like |
1969 |
- # /usr/lib/../lib64/. So while we don't install any files into |
1970 |
- # /usr/lib/, we do need it to exist. |
1971 |
- keepdir $(alt_prefix)/lib |
1972 |
- keepdir $(alt_prefix)/usr/lib |
1973 |
- |
1974 |
- dosym usr/include $(alt_prefix)/sys-include |
1975 |
- return 0 |
1976 |
- fi |
1977 |
- |
1978 |
- # Files for Debian-style locale updating |
1979 |
- dodir /usr/share/i18n |
1980 |
- sed \ |
1981 |
- -e "/^#/d" \ |
1982 |
- -e "/SUPPORTED-LOCALES=/d" \ |
1983 |
- -e "s: \\\\::g" -e "s:/: :g" \ |
1984 |
- "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
1985 |
- || die "generating /usr/share/i18n/SUPPORTED failed" |
1986 |
- cd "${WORKDIR}"/extra/locale |
1987 |
- dosbin locale-gen |
1988 |
- doman *.[0-8] |
1989 |
- insinto /etc |
1990 |
- doins locale.gen |
1991 |
- |
1992 |
- # Make sure all the ABI's can find the locales and so we only |
1993 |
- # have to generate one set |
1994 |
- local a |
1995 |
- keepdir /usr/$(get_libdir)/locale |
1996 |
- for a in $(get_install_abis) ; do |
1997 |
- if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
1998 |
- dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
1999 |
- fi |
2000 |
- done |
2001 |
- |
2002 |
- # HACK: If we're building for riscv, we need to additionally make sure that |
2003 |
- # we can find the locale archive afterwards |
2004 |
- case ${CTARGET} in |
2005 |
- riscv*) |
2006 |
- if [[ ! -e ${ED}/usr/lib/locale ]] ; then |
2007 |
- dosym ../$(get_libdir)/locale /usr/lib/locale |
2008 |
- fi |
2009 |
- ;; |
2010 |
- *) ;; |
2011 |
- esac |
2012 |
- |
2013 |
- cd "${S}" |
2014 |
- |
2015 |
- # Install misc network config files |
2016 |
- insinto /etc |
2017 |
- doins posix/gai.conf nss/nsswitch.conf |
2018 |
- |
2019 |
- # Gentoo-specific |
2020 |
- newins "${FILESDIR}"/host.conf-1 host.conf |
2021 |
- |
2022 |
- if use nscd ; then |
2023 |
- doins nscd/nscd.conf |
2024 |
- |
2025 |
- newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd |
2026 |
- |
2027 |
- local nscd_args=( |
2028 |
- -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
2029 |
- ) |
2030 |
- |
2031 |
- sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
2032 |
- |
2033 |
- systemd_dounit nscd/nscd.service |
2034 |
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
2035 |
- fi |
2036 |
- |
2037 |
- echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
2038 |
- doenvd "${T}"/00glibc |
2039 |
- |
2040 |
- for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
2041 |
- [[ -s ${d} ]] && dodoc ${d} |
2042 |
- done |
2043 |
- dodoc -r ChangeLog.old |
2044 |
- |
2045 |
- # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
2046 |
- # creation of the "factory" symlink in pkg_postinst(). |
2047 |
- rm -f "${ED}"/etc/localtime |
2048 |
- |
2049 |
- # Generate all locales if this is a native build as locale generation |
2050 |
- if use compile-locales && ! is_crosscompile ; then |
2051 |
- run_locale_gen --inplace-glibc "${ED}/" |
2052 |
- sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die |
2053 |
- fi |
2054 |
-} |
2055 |
- |
2056 |
-glibc_headers_install() { |
2057 |
- local builddir=$(builddir "headers") |
2058 |
- cd "${builddir}" |
2059 |
- emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers |
2060 |
- |
2061 |
- insinto $(alt_headers)/gnu |
2062 |
- doins "${S}"/include/gnu/stubs.h |
2063 |
- |
2064 |
- # Make sure we install the sys-include symlink so that when |
2065 |
- # we build a 2nd stage cross-compiler, gcc finds the target |
2066 |
- # system headers correctly. See gcc/doc/gccinstall.info |
2067 |
- dosym usr/include $(alt_prefix)/sys-include |
2068 |
-} |
2069 |
- |
2070 |
-src_install() { |
2071 |
- if just_headers ; then |
2072 |
- export ABI=default |
2073 |
- glibc_headers_install |
2074 |
- return |
2075 |
- fi |
2076 |
- |
2077 |
- foreach_abi glibc_do_src_install |
2078 |
- |
2079 |
- if ! use static-libs ; then |
2080 |
- elog "Not installing static glibc libraries" |
2081 |
- find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete |
2082 |
- fi |
2083 |
-} |
2084 |
- |
2085 |
-# Simple test to make sure our new glibc isn't completely broken. |
2086 |
-# Make sure we don't test with statically built binaries since |
2087 |
-# they will fail. Also, skip if this glibc is a cross compiler. |
2088 |
-# |
2089 |
-# If coreutils is built with USE=multicall, some of these files |
2090 |
-# will just be wrapper scripts, not actual ELFs we can test. |
2091 |
-glibc_sanity_check() { |
2092 |
- cd / #228809 |
2093 |
- |
2094 |
- # We enter ${ED} so to avoid trouble if the path contains |
2095 |
- # special characters; for instance if the path contains the |
2096 |
- # colon character (:), then the linker will try to split it |
2097 |
- # and look for the libraries in an unexpected place. This can |
2098 |
- # lead to unsafe code execution if the generated prefix is |
2099 |
- # within a world-writable directory. |
2100 |
- # (e.g. /var/tmp/portage:${HOSTNAME}) |
2101 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
2102 |
- |
2103 |
- local x striptest |
2104 |
- for x in cal date env free ls true uname uptime ; do |
2105 |
- x=$(type -p ${x}) |
2106 |
- [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
2107 |
- striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
2108 |
- case ${striptest} in |
2109 |
- *"statically linked"*) continue;; |
2110 |
- *"ASCII text"*) continue;; |
2111 |
- esac |
2112 |
- # We need to clear the locale settings as the upgrade might want |
2113 |
- # incompatible locale data. This test is not for verifying that. |
2114 |
- LC_ALL=C \ |
2115 |
- ./ld-*.so --library-path . ${x} > /dev/null \ |
2116 |
- || die "simple run test (${x}) failed" |
2117 |
- done |
2118 |
- |
2119 |
- popd >/dev/null |
2120 |
-} |
2121 |
- |
2122 |
-pkg_preinst() { |
2123 |
- # nothing to do if just installing headers |
2124 |
- just_headers && return |
2125 |
- |
2126 |
- # prepare /etc/ld.so.conf.d/ for files |
2127 |
- mkdir -p "${EROOT}"/etc/ld.so.conf.d |
2128 |
- |
2129 |
- # Default /etc/hosts.conf:multi to on for systems with small dbs. |
2130 |
- if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
2131 |
- sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
2132 |
- einfo "Defaulting /etc/host.conf:multi to on" |
2133 |
- fi |
2134 |
- |
2135 |
- [[ -n ${ROOT} ]] && return 0 |
2136 |
- [[ -d ${ED}/$(get_libdir) ]] || return 0 |
2137 |
- [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
2138 |
-} |
2139 |
- |
2140 |
-pkg_postinst() { |
2141 |
- # nothing to do if just installing headers |
2142 |
- just_headers && return |
2143 |
- |
2144 |
- if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
2145 |
- # Generate fastloading iconv module configuration file. |
2146 |
- "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/" |
2147 |
- fi |
2148 |
- |
2149 |
- if ! is_crosscompile && [[ -z ${ROOT} ]] ; then |
2150 |
- use compile-locales || run_locale_gen "${EROOT}/" |
2151 |
- fi |
2152 |
- |
2153 |
- # Check for sanity of /etc/nsswitch.conf, take 2 |
2154 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
2155 |
- local entry |
2156 |
- for entry in passwd group shadow; do |
2157 |
- if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
2158 |
- ewarn "" |
2159 |
- ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
2160 |
- ewarn "removed from glibc and is now provided by the package" |
2161 |
- ewarn " sys-auth/libnss-nis" |
2162 |
- ewarn "Install it now to keep your NIS setup working." |
2163 |
- ewarn "" |
2164 |
- fi |
2165 |
- done |
2166 |
- fi |
2167 |
-} |
2168 |
|
2169 |
diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml |
2170 |
deleted file mode 100644 |
2171 |
index 239f62a..0000000 |
2172 |
--- a/sys-libs/glibc/metadata.xml |
2173 |
+++ /dev/null |
2174 |
@@ -1,23 +0,0 @@ |
2175 |
-<?xml version="1.0" encoding="UTF-8"?> |
2176 |
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
2177 |
-<pkgmetadata> |
2178 |
-<maintainer type="project"> |
2179 |
- <email>toolchain@g.o</email> |
2180 |
- <name>Gentoo Toolchain Project</name> |
2181 |
-</maintainer> |
2182 |
-<use> |
2183 |
- <flag name="cet">Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)</flag> |
2184 |
- <flag name="compile-locales">build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow</flag> |
2185 |
- <flag name="crypt">build and install libcrypt and crypt.h</flag> |
2186 |
- <flag name="gd">build memusage and memusagestat tools</flag> |
2187 |
- <flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag> |
2188 |
- <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag> |
2189 |
- <flag name="ssp">protect stack of glibc internals</flag> |
2190 |
- <flag name="static-pie">Enable static PIE support (runtime files for -static-pie gcc option).</flag> |
2191 |
- <flag name="suid">Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5</flag> |
2192 |
- <flag name="systemtap">enable systemtap static probe points</flag> |
2193 |
-</use> |
2194 |
-<upstream> |
2195 |
- <remote-id type="cpe">cpe:/a:gnu:glibc</remote-id> |
2196 |
-</upstream> |
2197 |
-</pkgmetadata> |