Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
Date: Fri, 30 Oct 2020 21:45:47
Message-Id: 1604094317.f5bef89a1670a6116564c133efa817ffdaa02068.dilfridge@gentoo
1 commit: f5bef89a1670a6116564c133efa817ffdaa02068
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 30 19:36:48 2020 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 30 21:45:17 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5bef89a
7
8 sys-libs/glibc: Remove old
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.2
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 sys-libs/glibc/Manifest | 1 -
14 sys-libs/glibc/glibc-2.32-r1.ebuild | 1505 -----------------------------------
15 2 files changed, 1506 deletions(-)
16
17 diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
18 index 90e1d760143..0131d63d77c 100644
19 --- a/sys-libs/glibc/Manifest
20 +++ b/sys-libs/glibc/Manifest
21 @@ -11,7 +11,6 @@ DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811
22 DIST glibc-2.31-patches-8.tar.xz 60868 BLAKE2B c641a77cab0b3e5379a6911a548483266110d747300f6bd4c138754cc35aff266088be8682ba45ac105c946ee309db0bc094b0c3bc48fd4303c925a7594e17e2 SHA512 1bc069d487ff9d4cd33c5d293bb0789114f65af5179b3d9df8ff0a9f043d5ffbcd030d8eabc90b329c896dfdd0409c4b8dac371eafdd380ecc660b9540320637
23 DIST glibc-2.31-patches-9.tar.xz 74712 BLAKE2B 62991b67de4def4cca944e8420d2f0139f88b6754c6bc81072bb321c574c1db22641857345325848e1dfb551c10758f582e4425e687a7921cdbd4e7e7923a047 SHA512 699d898e3a8ed02b04573c675f572076e8f747767bfc577a033a49cd7d9078a7a60ac325acd4bd419a93b56edf90ce067baa7578ab315e27885f1f0e13916354
24 DIST glibc-2.31.tar.xz 16676764 BLAKE2B 91df1792345f157265eae405185a81fd4b8ce36d4c2388f44b0d5b1ae38174ea374cbc909cd260770b9f38ea58051da13766d4fa22abf41c2d4a2493257b179b SHA512 735e4c0ef10418b6ea945ad3906585e5bbd8b282d76f2131309dce4cec6b15066a5e4a3731773ce428a819b542579c9957867bb0abf05ed2030983fca4412306
25 -DIST glibc-2.32-patches-1.tar.xz 7640 BLAKE2B 849bdc1108e1f68f307bb9673f5ecda7c5470815f7d2de7956d529b638aafd4a8f37c22f79bc89d8e5f2efd51878927d3999d80586ec1074c46a52b6e148ea18 SHA512 a206d69693c3d9c527e17307b413aed05bcdefdf2537bb16af97ef31e85e4c48812971b60c00107b6a7c4bdc83c7e8ba1c9ea96f5641520852f98928f1018349
26 DIST glibc-2.32-patches-2.tar.xz 8588 BLAKE2B 57a85241e3270d14df0332b039a933c5a7ee4d089684d85cca564eeec2d6796735de60b628c5746858757342922d58993d6cf7187ce1d7102b2299ca2cf8513f SHA512 45bbab9e2f813f55cb4a1438dcd9365170b8facff50b11648ba6022da06c20029bb65a4b06fd906af82aa7461b7374f85105fd7eedb7915cec3f1df3779b68a3
27 DIST glibc-2.32.tar.xz 16744512 BLAKE2B a56b4afbb35315c5cd6dca0f62e44455dceae3e6e88a8453621f9a5394a60ddf10ca9309b2db0911830c7fd77e3faa5d94694eb94d5b2c05fc5285cef52255da SHA512 8460c155b7003e04f18dabece4ed9ad77445fa2288a7dc08e80a8fc4c418828af29e0649951bd71a54ea2ad2d4da7570aafd9bdfe4a37e9951b772b442afe50b
28 DIST locale-gen-2.00.tar.gz 7738 BLAKE2B cde6de5ba3400aea24d0d5f1b79471f89f09fb747c8e371e38316c7ada92f967e0865f573f23cb353d82419c234724143c0aeca9eb70eb945dfc581cc7491eb1 SHA512 b609fddb9ec5e567c008841fef3390eddb5d6e7699a8271b3b8c0ade1b44b0ac2e5d1daa8b9acabf3432e3b88110b538a96f209b1ad0f9e988b7efce66606dff
29
30 diff --git a/sys-libs/glibc/glibc-2.32-r1.ebuild b/sys-libs/glibc/glibc-2.32-r1.ebuild
31 deleted file mode 100644
32 index 18d94a7b0ef..00000000000
33 --- a/sys-libs/glibc/glibc-2.32-r1.ebuild
34 +++ /dev/null
35 @@ -1,1505 +0,0 @@
36 -# Copyright 1999-2020 Gentoo Authors
37 -# Distributed under the terms of the GNU General Public License v2
38 -
39 -EAPI=7
40 -
41 -PYTHON_COMPAT=( python3_{6,7,8} )
42 -
43 -inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \
44 - multilib systemd multiprocessing
45 -
46 -DESCRIPTION="GNU libc C library"
47 -HOMEPAGE="https://www.gnu.org/software/libc/"
48 -LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
49 -SLOT="2.2"
50 -
51 -EMULTILIB_PKG="true"
52 -
53 -# Gentoo patchset (ignored for live ebuilds)
54 -PATCH_VER=1
55 -PATCH_DEV=dilfridge
56 -
57 -if [[ ${PV} == 9999* ]]; then
58 - inherit git-r3
59 -else
60 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
61 - SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
62 - SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
63 - SRC_URI+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
64 -fi
65 -
66 -RELEASE_VER=${PV}
67 -
68 -GCC_BOOTSTRAP_VER=20180511
69 -
70 -LOCALE_GEN_VER=2.10
71 -
72 -SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
73 -SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
74 -
75 -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"
76 -
77 -# Minimum kernel version that glibc requires
78 -MIN_KERN_VER="3.2.0"
79 -
80 -# Here's how the cross-compile logic breaks down ...
81 -# CTARGET - machine that will target the binaries
82 -# CHOST - machine that will host the binaries
83 -# CBUILD - machine that will build the binaries
84 -# If CTARGET != CHOST, it means you want a libc for cross-compiling.
85 -# If CHOST != CBUILD, it means you want to cross-compile the libc.
86 -# CBUILD = CHOST = CTARGET - native build/install
87 -# CBUILD != (CHOST = CTARGET) - cross-compile a native build
88 -# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
89 -# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
90 -# For install paths:
91 -# CHOST = CTARGET - install into /
92 -# CHOST != CTARGET - install into /usr/CTARGET/
93 -#
94 -export CBUILD=${CBUILD:-${CHOST}}
95 -export CTARGET=${CTARGET:-${CHOST}}
96 -if [[ ${CTARGET} == ${CHOST} ]] ; then
97 - if [[ ${CATEGORY} == cross-* ]] ; then
98 - export CTARGET=${CATEGORY#cross-}
99 - fi
100 -fi
101 -
102 -# Note [Disable automatic stripping]
103 -# Disabling automatic stripping for a few reasons:
104 -# - portage's attempt to strip breaks non-native binaries at least on
105 -# arm: bug #697428
106 -# - portage's attempt to strip libpthread.so.0 breaks gdb thread
107 -# enumeration: bug #697910. This is quite subtle:
108 -# * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
109 -# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
110 -# via 'ps_pglobal_lookup' symbol defined in gdb.
111 -# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
112 -# known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
113 -# (unexported) is used to sanity check compatibility before enabling
114 -# debugging.
115 -# 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
116 -# * normal 'strip' command trims '.symtab'
117 -# Thus our main goal here is to prevent 'libpthread.so.0' from
118 -# losing it's '.symtab' entries.
119 -# As Gentoo's strip does not allow us to pass less aggressive stripping
120 -# options and does not check the machine target we strip selectively.
121 -
122 -# We need a new-enough binutils/gcc to match upstream baseline.
123 -# Also we need to make sure our binutils/gcc supports TLS,
124 -# and that gcc already contains the hardened patches.
125 -# Lastly, let's avoid some openssh nastiness, bug 708224, as
126 -# convenience to our users.
127 -BDEPEND="
128 - ${PYTHON_DEPS}
129 - >=app-misc/pax-utils-0.1.10
130 - sys-devel/bison
131 - doc? ( sys-apps/texinfo )
132 -"
133 -COMMON_DEPEND="
134 - gd? ( media-libs/gd:2= )
135 - nscd? ( selinux? (
136 - audit? ( sys-process/audit )
137 - caps? ( sys-libs/libcap )
138 - ) )
139 - suid? ( caps? ( sys-libs/libcap ) )
140 - selinux? ( sys-libs/libselinux )
141 - systemtap? ( dev-util/systemtap )
142 - !<net-misc/openssh-8.1_p1-r2
143 -"
144 -DEPEND="${COMMON_DEPEND}
145 - test? ( >=net-dns/libidn2-2.3.0 )
146 -"
147 -RDEPEND="${COMMON_DEPEND}
148 - sys-apps/gentoo-functions
149 -"
150 -
151 -RESTRICT="!test? ( test )"
152 -
153 -if [[ ${CATEGORY} == cross-* ]] ; then
154 - BDEPEND+=" !headers-only? (
155 - >=${CATEGORY}/binutils-2.24
156 - >=${CATEGORY}/gcc-6
157 - )"
158 - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
159 -else
160 - BDEPEND+="
161 - >=sys-devel/binutils-2.24
162 - >=sys-devel/gcc-6
163 - "
164 - DEPEND+=" virtual/os-headers "
165 - RDEPEND+="
166 - >=net-dns/libidn2-2.3.0
167 - vanilla? ( !sys-libs/timezone-data )
168 - "
169 - PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
170 -fi
171 -
172 -# Ignore tests whitelisted below
173 -GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}"
174 -
175 -# The following tests fail due to the Gentoo build system and are thus
176 -# executed but ignored:
177 -XFAIL_TEST_LIST=(
178 - # 9) Failures of unknown origin
179 - tst-latepthread
180 -
181 - # buggy test, assumes /dev/ and /dev/null on a single filesystem
182 - # 'mount --bind /dev/null /chroot/dev/null' breaks it.
183 - # https://sourceware.org/PR25909
184 - tst-support_descriptors
185 -
186 - # Flaky test, known to fail occasionally:
187 - # https://sourceware.org/PR19329
188 - # https://bugs.gentoo.org/719674#c12
189 - tst-stack4
190 -)
191 -
192 -#
193 -# Small helper functions
194 -#
195 -
196 -is_crosscompile() {
197 - [[ ${CHOST} != ${CTARGET} ]]
198 -}
199 -
200 -just_headers() {
201 - is_crosscompile && use headers-only
202 -}
203 -
204 -alt_prefix() {
205 - is_crosscompile && echo /usr/${CTARGET}
206 -}
207 -
208 -# This prefix is applicable to CHOST when building against this
209 -# glibc. It is baked into the library at configure time.
210 -host_eprefix() {
211 - is_crosscompile || echo "${EPREFIX}"
212 -}
213 -
214 -# This prefix is applicable to CBUILD when building against this
215 -# glibc. It determines the destination path at install time.
216 -build_eprefix() {
217 - is_crosscompile && echo "${EPREFIX}"
218 -}
219 -
220 -# We need to be able to set alternative headers for compiling for non-native
221 -# platform. Will also become useful for testing kernel-headers without screwing
222 -# up the whole system.
223 -alt_headers() {
224 - echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
225 -}
226 -
227 -alt_build_headers() {
228 - if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
229 - ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
230 - if tc-is-cross-compiler ; then
231 - ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
232 - if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
233 - local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
234 - ALT_BUILD_HEADERS=${header_path%/linux/version.h}
235 - fi
236 - fi
237 - fi
238 - echo "${ALT_BUILD_HEADERS}"
239 -}
240 -
241 -alt_libdir() {
242 - echo $(alt_prefix)/$(get_libdir)
243 -}
244 -alt_usrlibdir() {
245 - echo $(alt_prefix)/usr/$(get_libdir)
246 -}
247 -
248 -builddir() {
249 - echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
250 -}
251 -
252 -do_compile_test() {
253 - local ret save_cflags=${CFLAGS}
254 - CFLAGS+=" $1"
255 - shift
256 -
257 - pushd "${T}" >/dev/null
258 -
259 - rm -f glibc-test*
260 - printf '%b' "$*" > glibc-test.c
261 -
262 - # Most of the time CC is already set, but not in early sanity checks.
263 - nonfatal emake glibc-test CC="${CC-$(tc-getCC ${CTARGET})}"
264 - ret=$?
265 -
266 - popd >/dev/null
267 -
268 - CFLAGS=${save_cflags}
269 - return ${ret}
270 -}
271 -
272 -do_run_test() {
273 - local ret
274 -
275 - if [[ ${MERGE_TYPE} == "binary" ]] ; then
276 - # ignore build failures when installing a binary package #324685
277 - do_compile_test "" "$@" 2>/dev/null || return 0
278 - else
279 - if ! do_compile_test "" "$@" ; then
280 - ewarn "Simple build failed ... assuming this is desired #324685"
281 - return 0
282 - fi
283 - fi
284 -
285 - pushd "${T}" >/dev/null
286 -
287 - ./glibc-test
288 - ret=$?
289 - rm -f glibc-test*
290 -
291 - popd >/dev/null
292 -
293 - return ${ret}
294 -}
295 -
296 -setup_target_flags() {
297 - # This largely mucks with compiler flags. None of which should matter
298 - # when building up just the headers.
299 - just_headers && return 0
300 -
301 - case $(tc-arch) in
302 - x86)
303 - # -march needed for #185404 #199334
304 - # TODO: When creating the first glibc cross-compile, this test will
305 - # always fail as it does a full link which in turn requires glibc.
306 - # Probably also applies when changing multilib profile settings (e.g.
307 - # enabling x86 when the profile was amd64-only previously).
308 - # We could change main to _start and pass -nostdlib here so that we
309 - # only test the gcc code compilation. Or we could do a compile and
310 - # then look for the symbol via scanelf.
311 - 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
312 - local t=${CTARGET_OPT:-${CTARGET}}
313 - t=${t%%-*}
314 - filter-flags '-march=*'
315 - export CFLAGS="-march=${t} ${CFLAGS}"
316 - einfo "Auto adding -march=${t} to CFLAGS #185404"
317 - fi
318 - ;;
319 - amd64)
320 - # -march needed for #185404 #199334
321 - # TODO: See cross-compile issues listed above for x86.
322 - [[ ${ABI} == x86 ]] &&
323 - 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
324 - local t=${CTARGET_OPT:-${CTARGET}}
325 - t=${t%%-*}
326 - # Normally the target is x86_64-xxx, so turn that into the -march that
327 - # gcc actually accepts. #528708
328 - [[ ${t} == "x86_64" ]] && t="x86-64"
329 - filter-flags '-march=*'
330 - # ugly, ugly, ugly. ugly.
331 - CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}")
332 - export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
333 - einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
334 - fi
335 - ;;
336 - mips)
337 - # The mips abi cannot support the GNU style hashes. #233233
338 - filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
339 - ;;
340 - ppc|ppc64)
341 - # Many arch-specific implementations do not work on ppc with
342 - # cache-block not equal to 128 bytes. This breaks memset:
343 - # https://sourceware.org/PR26522
344 - # https://bugs.gentoo.org/737996
345 - # Use default -mcpu=. For ppc it means non-multiarch setup.
346 - filter-flags '-mcpu=*'
347 - ;;
348 - sparc)
349 - # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
350 - filter-flags "-fcall-used-g7"
351 - append-flags "-fcall-used-g6"
352 -
353 - local cpu
354 - case ${CTARGET} in
355 - sparc64-*)
356 - cpu="sparc64"
357 - case $(get-flag mcpu) in
358 - v9)
359 - # We need to force at least v9a because the base build doesn't
360 - # work with just v9.
361 - # https://sourceware.org/bugzilla/show_bug.cgi?id=19477
362 - append-flags "-Wa,-xarch=v9a"
363 - ;;
364 - esac
365 - ;;
366 - sparc-*)
367 - case $(get-flag mcpu) in
368 - v8|supersparc|hypersparc|leon|leon3)
369 - cpu="sparcv8"
370 - ;;
371 - *)
372 - cpu="sparcv9"
373 - ;;
374 - esac
375 - ;;
376 - esac
377 - [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
378 - ;;
379 - esac
380 -}
381 -
382 -setup_flags() {
383 - # Make sure host make.conf doesn't pollute us
384 - if is_crosscompile || tc-is-cross-compiler ; then
385 - CHOST=${CTARGET} strip-unsupported-flags
386 - fi
387 -
388 - # Store our CFLAGS because it's changed depending on which CTARGET
389 - # we are building when pulling glibc on a multilib profile
390 - CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
391 - CFLAGS=${CFLAGS_BASE}
392 - CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
393 - CXXFLAGS=${CXXFLAGS_BASE}
394 - ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
395 - ASFLAGS=${ASFLAGS_BASE}
396 -
397 - # Allow users to explicitly avoid flag sanitization via
398 - # USE=custom-cflags.
399 - if ! use custom-cflags; then
400 - # Over-zealous CFLAGS can often cause problems. What may work for one
401 - # person may not work for another. To avoid a large influx of bugs
402 - # relating to failed builds, we strip most CFLAGS out to ensure as few
403 - # problems as possible.
404 - strip-flags
405 - # Lock glibc at -O2; we want to be conservative here.
406 - filter-flags '-O?'
407 - append-flags -O2
408 - fi
409 - strip-unsupported-flags
410 - filter-flags -m32 -m64 '-mabi=*'
411 -
412 - # glibc aborts if rpath is set by LDFLAGS
413 - filter-ldflags '-Wl,-rpath=*'
414 -
415 - # #492892
416 - filter-flags -frecord-gcc-switches
417 -
418 - unset CBUILD_OPT CTARGET_OPT
419 - if use multilib ; then
420 - CTARGET_OPT=$(get_abi_CTARGET)
421 - [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
422 - fi
423 -
424 - setup_target_flags
425 -
426 - if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
427 - CBUILD_OPT=${CTARGET_OPT}
428 - fi
429 -
430 - # glibc's headers disallow -O0 and fail at build time:
431 - # include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
432 - replace-flags -O0 -O1
433 -
434 - filter-flags '-fstack-protector*'
435 -}
436 -
437 -want_tls() {
438 - # Archs that can use TLS (Thread Local Storage)
439 - case $(tc-arch) in
440 - x86)
441 - # requires i486 or better #106556
442 - [[ ${CTARGET} == i[4567]86* ]] && return 0
443 - return 1
444 - ;;
445 - esac
446 - return 0
447 -}
448 -
449 -want__thread() {
450 - want_tls || return 1
451 -
452 - # For some reason --with-tls --with__thread is causing segfaults on sparc32.
453 - [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
454 -
455 - [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
456 -
457 - # only test gcc -- can't test linking yet
458 - tc-has-tls -c ${CTARGET}
459 - WANT__THREAD=$?
460 -
461 - return ${WANT__THREAD}
462 -}
463 -
464 -use_multiarch() {
465 - # Allow user to disable runtime arch detection in multilib.
466 - use multiarch || return 1
467 - # Make sure binutils is new enough to support indirect functions,
468 - # #336792. This funky sed supports gold and bfd linkers.
469 - local bver nver
470 - bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
471 - case $(tc-arch ${CTARGET}) in
472 - amd64|x86) nver="2.20" ;;
473 - arm) nver="2.22" ;;
474 - hppa) nver="2.23" ;;
475 - ppc|ppc64) nver="2.20" ;;
476 - # ifunc support was added in 2.23, but glibc also needs
477 - # machinemode which is in 2.24.
478 - s390) nver="2.24" ;;
479 - sparc) nver="2.21" ;;
480 - *) return 1 ;;
481 - esac
482 - ver_test ${bver} -ge ${nver}
483 -}
484 -
485 -# Setup toolchain variables that had historically been defined in the
486 -# profiles for these archs.
487 -setup_env() {
488 - # silly users
489 - unset LD_RUN_PATH
490 - unset LD_ASSUME_KERNEL
491 -
492 - if is_crosscompile || tc-is-cross-compiler ; then
493 - multilib_env ${CTARGET_OPT:-${CTARGET}}
494 -
495 - if ! use multilib ; then
496 - MULTILIB_ABIS=${DEFAULT_ABI}
497 - else
498 - MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
499 - fi
500 -
501 - # If the user has CFLAGS_<CTARGET> in their make.conf, use that,
502 - # and fall back on CFLAGS.
503 - local VAR=CFLAGS_${CTARGET//[-.]/_}
504 - CFLAGS=${!VAR-${CFLAGS}}
505 - einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}"
506 - fi
507 -
508 - setup_flags
509 -
510 - export ABI=${ABI:-${DEFAULT_ABI:-default}}
511 -
512 - if just_headers ; then
513 - # Avoid mixing host's CC and target's CFLAGS_${ABI}:
514 - # At this bootstrap stage we have only binutils for
515 - # target but not compiler yet.
516 - einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
517 - return 0
518 - fi
519 - local VAR=CFLAGS_${ABI}
520 - # We need to export CFLAGS with abi information in them because glibc's
521 - # configure script checks CFLAGS for some targets (like mips). Keep
522 - # around the original clean value to avoid appending multiple ABIs on
523 - # top of each other.
524 - : ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
525 - export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
526 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
527 -}
528 -
529 -foreach_abi() {
530 - setup_env
531 -
532 - local ret=0
533 - local abilist=""
534 - if use multilib ; then
535 - abilist=$(get_install_abis)
536 - else
537 - abilist=${DEFAULT_ABI}
538 - fi
539 - local -x ABI
540 - for ABI in ${abilist:-default} ; do
541 - setup_env
542 - einfo "Running $1 for ABI ${ABI}"
543 - $1
544 - : $(( ret |= $? ))
545 - done
546 - return ${ret}
547 -}
548 -
549 -glibc_banner() {
550 - local b="Gentoo ${PVR}"
551 - [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
552 - echo "${b}"
553 -}
554 -
555 -# The following Kernel version handling functions are mostly copied from portage
556 -# source. It's better not to use linux-info.eclass here since a) it adds too
557 -# much magic, see bug 326693 for some of the arguments, and b) some of the
558 -# functions are just not provided.
559 -
560 -g_get_running_KV() {
561 - uname -r
562 - return $?
563 -}
564 -
565 -g_KV_major() {
566 - [[ -z $1 ]] && return 1
567 - local KV=$@
568 - echo "${KV%%.*}"
569 -}
570 -
571 -g_KV_minor() {
572 - [[ -z $1 ]] && return 1
573 - local KV=$@
574 - KV=${KV#*.}
575 - echo "${KV%%.*}"
576 -}
577 -
578 -g_KV_micro() {
579 - [[ -z $1 ]] && return 1
580 - local KV=$@
581 - KV=${KV#*.*.}
582 - echo "${KV%%[^[:digit:]]*}"
583 -}
584 -
585 -g_KV_to_int() {
586 - [[ -z $1 ]] && return 1
587 - local KV_MAJOR=$(g_KV_major "$1")
588 - local KV_MINOR=$(g_KV_minor "$1")
589 - local KV_MICRO=$(g_KV_micro "$1")
590 - local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
591 -
592 - # We make version 2.2.0 the minimum version we will handle as
593 - # a sanity check ... if its less, we fail ...
594 - if [[ ${KV_int} -ge 131584 ]] ; then
595 - echo "${KV_int}"
596 - return 0
597 - fi
598 - return 1
599 -}
600 -
601 -g_int_to_KV() {
602 - local version=$1 major minor micro
603 - major=$((version / 65536))
604 - minor=$(((version % 65536) / 256))
605 - micro=$((version % 256))
606 - echo ${major}.${minor}.${micro}
607 -}
608 -
609 -eend_KV() {
610 - [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
611 - eend $?
612 -}
613 -
614 -get_kheader_version() {
615 - printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
616 - $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
617 - tail -n 1
618 -}
619 -
620 -# We collect all sanity checks here. Consistency is not guranteed between
621 -# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
622 -# src_unpack.
623 -sanity_prechecks() {
624 - # Prevent native builds from downgrading
625 - if [[ ${MERGE_TYPE} != "buildonly" ]] && \
626 - [[ -z ${ROOT} ]] && \
627 - [[ ${CBUILD} == ${CHOST} ]] && \
628 - [[ ${CHOST} == ${CTARGET} ]] ; then
629 -
630 - # The high rev # is to allow people to downgrade between -r#
631 - # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
632 - # should be fine. Hopefully we never actually use a r# this
633 - # high.
634 - if has_version ">${CATEGORY}/${P}-r10000" ; then
635 - eerror "Sanity check to keep you from breaking your system:"
636 - eerror " Downgrading glibc is not supported and a sure way to destruction."
637 - [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
638 - fi
639 -
640 - if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
641 - eerror "Your old kernel is broken. You need to update it to a newer"
642 - eerror "version as syscall(<bignum>) will break. See bug 279260."
643 - die "Old and broken kernel."
644 - fi
645 - fi
646 -
647 - # Users have had a chance to phase themselves, time to give em the boot
648 - if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
649 - eerror "You still haven't deleted ${EROOT}/etc/locales.build."
650 - eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
651 - die "Lazy upgrader detected"
652 - fi
653 -
654 - if [[ ${CTARGET} == i386-* ]] ; then
655 - eerror "i386 CHOSTs are no longer supported."
656 - eerror "Chances are you don't actually want/need i386."
657 - eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
658 - die "Please fix your CHOST"
659 - fi
660 -
661 - if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
662 - ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
663 - ewarn "This will result in a 50% performance penalty when running with a 32bit"
664 - ewarn "hypervisor, which is probably not what you want."
665 - fi
666 -
667 - # Check for sanity of /etc/nsswitch.conf
668 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
669 - local entry
670 - for entry in passwd group shadow; do
671 - if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
672 - eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
673 - eerror "Please make sure you have 'files' entries for"
674 - eerror "'passwd:', 'group:' and 'shadow:' databases."
675 - eerror "For more details see:"
676 - eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
677 - die "nsswitch.conf has no 'files' provider in '${entry}'."
678 - fi
679 - done
680 - fi
681 -
682 - # ABI-specific checks follow here. Hey, we have a lot more specific conditions that
683 - # we test for...
684 - if ! is_crosscompile ; then
685 - if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
686 - ebegin "Checking that IA32 emulation is enabled in the running kernel"
687 - echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
688 - local STAT
689 - if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then
690 - "${T}/check-ia32-emulation.elf32"
691 - STAT=$?
692 - else
693 - # Don't fail here to allow single->multi ABI switch
694 - # or recover from breakage like bug #646424
695 - ewarn "Failed to compile the ABI test. Broken host glibc?"
696 - STAT=0
697 - fi
698 - rm -f "${T}/check-ia32-emulation.elf32"
699 - eend $STAT
700 - [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
701 - fi
702 -
703 - fi
704 -
705 - # When we actually have to compile something...
706 - if ! just_headers ; then
707 - ebegin "Checking gcc for __thread support"
708 - if ! eend $(want__thread ; echo $?) ; then
709 - echo
710 - eerror "Could not find a gcc that supports the __thread directive!"
711 - eerror "Please update your binutils/gcc and try again."
712 - die "No __thread support in gcc!"
713 - fi
714 -
715 - if [[ ${CTARGET} == *-linux* ]] ; then
716 - local run_kv build_kv want_kv
717 -
718 - run_kv=$(g_get_running_KV)
719 - build_kv=$(g_int_to_KV $(get_kheader_version))
720 - want_kv=${MIN_KERN_VER}
721 -
722 - if ! is_crosscompile && ! tc-is-cross-compiler ; then
723 - # Building fails on an non-supporting kernel
724 - ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
725 - if ! eend_KV ${run_kv} ${want_kv} ; then
726 - echo
727 - eerror "You need a kernel of at least ${want_kv}!"
728 - die "Kernel version too low!"
729 - fi
730 - fi
731 -
732 - ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
733 - if ! eend_KV ${build_kv} ${want_kv} ; then
734 - echo
735 - eerror "You need linux-headers of at least ${want_kv}!"
736 - die "linux-headers version too low!"
737 - fi
738 - fi
739 - fi
740 -}
741 -
742 -#
743 -# the phases
744 -#
745 -
746 -# pkg_pretend
747 -
748 -pkg_pretend() {
749 - # All the checks...
750 - einfo "Checking general environment sanity."
751 - sanity_prechecks
752 -}
753 -
754 -pkg_setup() {
755 - # see bug 682570
756 - [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
757 -}
758 -
759 -# src_unpack
760 -
761 -src_unpack() {
762 - # Consistency is not guaranteed between pkg_ and src_ ...
763 - sanity_prechecks
764 -
765 - use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
766 -
767 - setup_env
768 -
769 - if [[ ${PV} == 9999* ]] ; then
770 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git"
771 - EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
772 - git-r3_src_unpack
773 - mv patches-git/9999 patches || die
774 -
775 - EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
776 - EGIT_CHECKOUT_DIR=${S}
777 - git-r3_src_unpack
778 - else
779 - unpack ${P}.tar.xz
780 -
781 - cd "${WORKDIR}" || die
782 - unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
783 - fi
784 -
785 - cd "${WORKDIR}" || die
786 - unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
787 - use riscv && unpack backport-rv32.txz
788 -}
789 -
790 -src_prepare() {
791 - local patchsetname
792 - if ! use vanilla ; then
793 - if [[ ${PV} == 9999* ]] ; then
794 - patchsetname="from git master"
795 - else
796 - patchsetname="${RELEASE_VER}-${PATCH_VER}"
797 - fi
798 - elog "Applying Gentoo Glibc Patchset ${patchsetname}"
799 - eapply "${WORKDIR}"/patches
800 - einfo "Done."
801 -
802 - if use riscv ; then
803 - elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
804 - eapply "${WORKDIR}"/backport-rv32
805 - einfo "Done."
806 - fi
807 - fi
808 -
809 - default
810 -
811 - gnuconfig_update
812 -
813 - cd "${WORKDIR}"
814 - find . -name configure -exec touch {} +
815 -
816 - # move the external locale-gen to its old place
817 - mkdir extra || die
818 - mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
819 -
820 - eprefixify extra/locale/locale-gen
821 -
822 - # Fix permissions on some of the scripts.
823 - chmod u+x "${S}"/scripts/*.sh
824 -
825 - cd "${S}"
826 -}
827 -
828 -glibc_do_configure() {
829 - # Glibc does not work with gold (for various reasons) #269274.
830 - tc-ld-disable-gold
831 -
832 - # CXX isnt handled by the multilib system, so if we dont unset here
833 - # we accumulate crap across abis
834 - unset CXX
835 -
836 - einfo "Configuring glibc for nptl"
837 -
838 - if use doc ; then
839 - export MAKEINFO=makeinfo
840 - else
841 - export MAKEINFO=/dev/null
842 - fi
843 -
844 - local v
845 - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do
846 - einfo " $(printf '%15s' ${v}:) ${!v}"
847 - done
848 -
849 - # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
850 - # To build .S (assembly) files with the same ABI-specific flags
851 - # upstream currently recommends adding CFLAGS to CC/CXX:
852 - # https://sourceware.org/PR23273
853 - # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
854 - # and breaks multiarch support. See 659030#c3 for an example.
855 - # The glibc configure script doesn't properly use LDFLAGS all the time.
856 - export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
857 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
858 -
859 - # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
860 - export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
861 -
862 - if is_crosscompile; then
863 - # Assume worst-case bootstrap: glibc is buil first time
864 - # when ${CTARGET}-g++ is not available yet. We avoid
865 - # building auxiliary programs that require C++: bug #683074
866 - # It should not affect final result.
867 - export libc_cv_cxx_link_ok=no
868 - # The line above has the same effect. We set CXX explicitly
869 - # to make build logs less confusing.
870 - export CXX=
871 - fi
872 - einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
873 -
874 - # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
875 - # can't detect them automatically due to ${CHOST} mismatch and fallbacks
876 - # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup().
877 - export NM="$(tc-getNM ${CTARGET})"
878 - export READELF="$(tc-getREADELF ${CTARGET})"
879 - einfo " $(printf '%15s' 'Manual NM:') ${NM}"
880 - einfo " $(printf '%15s' 'Manual READELF:') ${READELF}"
881 -
882 - echo
883 -
884 - local myconf=()
885 -
886 - case ${CTARGET} in
887 - m68k*)
888 - # setjmp() is not compatible with stack protection:
889 - # https://sourceware.org/PR24202
890 - myconf+=( --enable-stack-protector=no )
891 - ;;
892 - powerpc-*)
893 - # Currently gcc on powerpc32 generates invalid code for
894 - # __builtin_return_address(0) calls. Normally programs
895 - # don't do that but malloc hooks in glibc do:
896 - # https://gcc.gnu.org/PR81996
897 - # https://bugs.gentoo.org/629054
898 - myconf+=( --enable-stack-protector=no )
899 - ;;
900 - *)
901 - # Use '=strong' instead of '=all' to protect only functions
902 - # worth protecting from stack smashes.
903 - # '=all' is also known to have a problem in IFUNC resolution
904 - # tests: https://sourceware.org/PR25680, bug #712356.
905 - myconf+=( --enable-stack-protector=$(usex ssp strong no) )
906 - ;;
907 - esac
908 - myconf+=( --enable-stackguard-randomization )
909 -
910 - # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
911 - # is not robust enough to detect proper support:
912 - # https://bugs.gentoo.org/641216
913 - # https://sourceware.org/PR22634#c0
914 - case $(tc-arch ${CTARGET}) in
915 - # Keep whitelist of targets where autodetection mostly works.
916 - amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
917 - # Blacklist everywhere else
918 - *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
919 - esac
920 -
921 - # Enable Intel Control-flow Enforcement Technology on amd64 if requested
922 - case ${CTARGET} in
923 - x86_64-*) myconf+=( $(use_enable cet) ) ;;
924 - *) ;;
925 - esac
926 -
927 - [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
928 -
929 - myconf+=( --enable-kernel=${MIN_KERN_VER} )
930 -
931 - # Since SELinux support is only required for nscd, only enable it if:
932 - # 1. USE selinux
933 - # 2. only for the primary ABI on multilib systems
934 - # 3. Not a crosscompile
935 - if ! is_crosscompile && use selinux ; then
936 - if use multilib ; then
937 - if is_final_abi ; then
938 - myconf+=( --with-selinux )
939 - else
940 - myconf+=( --without-selinux )
941 - fi
942 - else
943 - myconf+=( --with-selinux )
944 - fi
945 - else
946 - myconf+=( --without-selinux )
947 - fi
948 -
949 - # Force a few tests where we always know the answer but
950 - # configure is incapable of finding it.
951 - if is_crosscompile ; then
952 - export \
953 - libc_cv_c_cleanup=yes \
954 - libc_cv_forced_unwind=yes
955 - fi
956 -
957 - myconf+=(
958 - --without-cvs
959 - --disable-werror
960 - --enable-bind-now
961 - --build=${CBUILD_OPT:-${CBUILD}}
962 - --host=${CTARGET_OPT:-${CTARGET}}
963 - $(use_enable profile)
964 - $(use_with gd)
965 - --with-headers=$(build_eprefix)$(alt_build_headers)
966 - --prefix="$(host_eprefix)/usr"
967 - --sysconfdir="$(host_eprefix)/etc"
968 - --localstatedir="$(host_eprefix)/var"
969 - --libdir='$(prefix)'/$(get_libdir)
970 - --mandir='$(prefix)'/share/man
971 - --infodir='$(prefix)'/share/info
972 - --libexecdir='$(libdir)'/misc/glibc
973 - --with-bugurl=https://bugs.gentoo.org/
974 - --with-pkgversion="$(glibc_banner)"
975 - $(use_enable crypt)
976 - $(use_multiarch || echo --disable-multi-arch)
977 - $(use_enable static-pie)
978 - $(use_enable systemtap)
979 - $(use_enable nscd)
980 - ${EXTRA_ECONF}
981 - )
982 -
983 - # We rely on sys-libs/timezone-data for timezone tools normally.
984 - myconf+=( $(use_enable vanilla timezone-tools) )
985 -
986 - # These libs don't have configure flags.
987 - ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
988 - ac_cv_lib_cap_cap_init=$(usex caps || echo no)
989 -
990 - # There is no configure option for this and we need to export it
991 - # since the glibc build will re-run configure on itself
992 - export libc_cv_rootsbindir="$(host_eprefix)/sbin"
993 - export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
994 -
995 - # We take care of patching our binutils to use both hash styles,
996 - # and many people like to force gnu hash style only, so disable
997 - # this overriding check. #347761
998 - export libc_cv_hashstyle=no
999 -
1000 - local builddir=$(builddir nptl)
1001 - mkdir -p "${builddir}"
1002 - cd "${builddir}"
1003 - set -- "${S}"/configure "${myconf[@]}"
1004 - echo "$@"
1005 - "$@" || die "failed to configure glibc"
1006 -
1007 - # ia64 static cross-compilers are a pita in so much that they
1008 - # can't produce static ELFs (as the libgcc.a is broken). so
1009 - # disable building of the programs for those targets if it
1010 - # doesn't work.
1011 - # XXX: We could turn this into a compiler test, but ia64 is
1012 - # the only one that matters, so this should be fine for now.
1013 - if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
1014 - sed -i '1i+link-static = touch $@' config.make
1015 - fi
1016 -
1017 - # If we're trying to migrate between ABI sets, we need
1018 - # to lie and use a local copy of gcc. Like if the system
1019 - # is built with MULTILIB_ABIS="amd64 x86" but we want to
1020 - # add x32 to it, gcc/glibc don't yet support x32.
1021 - #
1022 - if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
1023 - echo 'main(){}' > "${T}"/test.c
1024 - if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
1025 - sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
1026 - fi
1027 - fi
1028 -}
1029 -
1030 -glibc_headers_configure() {
1031 - export ABI=default
1032 -
1033 - local builddir=$(builddir "headers")
1034 - mkdir -p "${builddir}"
1035 - cd "${builddir}"
1036 -
1037 - # if we don't have a compiler yet, we can't really test it now ...
1038 - # hopefully they don't affect header generation, so let's hope for
1039 - # the best here ...
1040 - local v vars=(
1041 - ac_cv_header_cpuid_h=yes
1042 - libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
1043 - libc_cv_asm_cfi_directives=yes
1044 - libc_cv_broken_visibility_attribute=no
1045 - libc_cv_c_cleanup=yes
1046 - libc_cv_compiler_powerpc64le_binary128_ok=yes
1047 - libc_cv_forced_unwind=yes
1048 - libc_cv_gcc___thread=yes
1049 - libc_cv_mlong_double_128=yes
1050 - libc_cv_mlong_double_128ibm=yes
1051 - libc_cv_ppc_machine=yes
1052 - libc_cv_ppc_rel16=yes
1053 - libc_cv_predef_fortify_source=no
1054 - libc_cv_target_power8_ok=yes
1055 - libc_cv_visibility_attribute=yes
1056 - libc_cv_z_combreloc=yes
1057 - libc_cv_z_execstack=yes
1058 - libc_cv_z_initfirst=yes
1059 - libc_cv_z_nodelete=yes
1060 - libc_cv_z_nodlopen=yes
1061 - libc_cv_z_relro=yes
1062 - libc_mips_abi=${ABI}
1063 - libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
1064 - # These libs don't have configure flags.
1065 - ac_cv_lib_audit_audit_log_user_avc_message=no
1066 - ac_cv_lib_cap_cap_init=no
1067 - )
1068 -
1069 - einfo "Forcing cached settings:"
1070 - for v in "${vars[@]}" ; do
1071 - einfo " ${v}"
1072 - export ${v}
1073 - done
1074 -
1075 - local headers_only_arch_CPPFLAGS=()
1076 -
1077 - # Blow away some random CC settings that screw things up. #550192
1078 - if [[ -d ${S}/sysdeps/mips ]]; then
1079 - pushd "${S}"/sysdeps/mips >/dev/null
1080 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
1081 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
1082 -
1083 - # Force the mips ABI to the default. This is OK because the set of
1084 - # installed headers in this phase is the same between the 3 ABIs.
1085 - # If this ever changes, this hack will break, but that's unlikely
1086 - # as glibc discourages that behavior.
1087 - # https://crbug.com/647033
1088 - sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
1089 -
1090 - popd >/dev/null
1091 - fi
1092 -
1093 - case ${CTARGET} in
1094 - riscv*)
1095 - # RISC-V interrogates the compiler to determine which target to
1096 - # build. If building the headers then we don't strictly need a
1097 - # RISC-V compiler, so the built-in definitions that are provided
1098 - # along with all RISC-V compiler might not exist. This causes
1099 - # glibc's RISC-V preconfigure script to blow up. Since we're just
1100 - # building the headers any value will actually work here, so just
1101 - # pick the standard one (rv64g/lp64d) to make the build scripts
1102 - # happy for now -- the headers are all the same anyway so it
1103 - # doesn't matter.
1104 - headers_only_arch_CPPFLAGS+=(
1105 - -D__riscv_xlen=64
1106 - -D__riscv_flen=64
1107 - -D__riscv_float_abi_double=1
1108 - -D__riscv_atomic=1
1109 - ) ;;
1110 - esac
1111 -
1112 - local myconf=()
1113 - myconf+=(
1114 - --disable-sanity-checks
1115 - --enable-hacker-mode
1116 - --without-cvs
1117 - --disable-werror
1118 - --enable-bind-now
1119 - --build=${CBUILD_OPT:-${CBUILD}}
1120 - --host=${CTARGET_OPT:-${CTARGET}}
1121 - --with-headers=$(build_eprefix)$(alt_build_headers)
1122 - --prefix="$(host_eprefix)/usr"
1123 - ${EXTRA_ECONF}
1124 - )
1125 -
1126 - # Nothing is compiled here which would affect the headers for the target.
1127 - # So forcing CC/CFLAGS is sane.
1128 - local headers_only_CC=$(tc-getBUILD_CC)
1129 - local headers_only_CFLAGS="-O1 -pipe"
1130 - local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
1131 - local headers_only_LDFLAGS=""
1132 - set -- "${S}"/configure "${myconf[@]}"
1133 - echo \
1134 - "CC=${headers_only_CC}" \
1135 - "CFLAGS=${headers_only_CFLAGS}" \
1136 - "CPPFLAGS=${headers_only_CPPFLAGS}" \
1137 - "LDFLAGS=${headers_only_LDFLAGS}" \
1138 - "$@"
1139 - CC=${headers_only_CC} \
1140 - CFLAGS=${headers_only_CFLAGS} \
1141 - CPPFLAGS=${headers_only_CPPFLAGS} \
1142 - LDFLAGS="" \
1143 - "$@" || die "failed to configure glibc"
1144 -}
1145 -
1146 -do_src_configure() {
1147 - if just_headers ; then
1148 - glibc_headers_configure
1149 - else
1150 - glibc_do_configure nptl
1151 - fi
1152 -}
1153 -
1154 -src_configure() {
1155 - foreach_abi do_src_configure
1156 -}
1157 -
1158 -do_src_compile() {
1159 - emake -C "$(builddir nptl)"
1160 -}
1161 -
1162 -src_compile() {
1163 - if just_headers ; then
1164 - return
1165 - fi
1166 -
1167 - foreach_abi do_src_compile
1168 -}
1169 -
1170 -glibc_src_test() {
1171 - cd "$(builddir nptl)"
1172 -
1173 - local myxfailparams=""
1174 - if [[ "${GENTOO_GLIBC_XFAIL_TESTS}" == "yes" ]] ; then
1175 - for myt in ${XFAIL_TEST_LIST[@]} ; do
1176 - myxfailparams+="test-xfail-${myt}=yes "
1177 - done
1178 - fi
1179 -
1180 - # sandbox does not understand unshare() and prevents
1181 - # writes to /proc/, which makes many tests fail
1182 -
1183 - SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check
1184 -}
1185 -
1186 -do_src_test() {
1187 - local ret=0
1188 -
1189 - glibc_src_test
1190 - : $(( ret |= $? ))
1191 -
1192 - return ${ret}
1193 -}
1194 -
1195 -src_test() {
1196 - if just_headers ; then
1197 - return
1198 - fi
1199 -
1200 - # Give tests more time to complete.
1201 - export TIMEOUTFACTOR=5
1202 -
1203 - foreach_abi do_src_test || die "tests failed"
1204 -}
1205 -
1206 -run_locale_gen() {
1207 - # if the host locales.gen contains no entries, we'll install everything
1208 - local root="$1"
1209 - local inplace=""
1210 -
1211 - if [[ "${root}" == "--inplace-glibc" ]] ; then
1212 - inplace="--inplace-glibc"
1213 - root="$2"
1214 - fi
1215 -
1216 - local locale_list="${root}/etc/locale.gen"
1217 -
1218 - pushd "${ED}"/$(get_libdir) >/dev/null
1219 -
1220 - if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
1221 - [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
1222 - locale_list="${root}/usr/share/i18n/SUPPORTED"
1223 - fi
1224 -
1225 - set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
1226 - --destdir "${root}"
1227 - echo "$@"
1228 - "$@"
1229 -
1230 - popd >/dev/null
1231 -}
1232 -
1233 -glibc_do_src_install() {
1234 - local builddir=$(builddir nptl)
1235 - cd "${builddir}"
1236 -
1237 - emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
1238 -
1239 - # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
1240 - # which come without headers etc. Only needed for binary packages since the
1241 - # external net-libs/libnsl has increased soversion. Keep only versioned libraries.
1242 - find "${D}" -name "libnsl.a" -delete
1243 - find "${D}" -name "libnsl.so" -delete
1244 -
1245 - # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
1246 - # to infer upstream version:
1247 - # '#define VERSION "2.26.90"' -> '2.26.90'
1248 - local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
1249 -
1250 - # Avoid stripping binaries not targeted by ${CHOST}. Or else
1251 - # ${CHOST}-strip would break binaries build for ${CTARGET}.
1252 - is_crosscompile && dostrip -x /
1253 - # gdb thread introspection relies on local libpthreas symbols. stripping breaks it
1254 - # See Note [Disable automatic stripping]
1255 - dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
1256 -
1257 - if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
1258 - # Move versioned .a file out of libdir to evade portage QA checks
1259 - # instead of using gen_usr_ldscript(). We fix ldscript as:
1260 - # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
1261 - sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
1262 - dodir $(alt_usrlibdir)/${P}
1263 - mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
1264 - fi
1265 -
1266 - # We'll take care of the cache ourselves
1267 - rm -f "${ED}"/etc/ld.so.cache
1268 -
1269 - # Everything past this point just needs to be done once ...
1270 - is_final_abi || return 0
1271 -
1272 - # Make sure the non-native interp can be found on multilib systems even
1273 - # if the main library set isn't installed into the right place. Maybe
1274 - # we should query the active gcc for info instead of hardcoding it ?
1275 - local i ldso_abi ldso_name
1276 - local ldso_abi_list=(
1277 - # x86
1278 - amd64 /lib64/ld-linux-x86-64.so.2
1279 - x32 /libx32/ld-linux-x32.so.2
1280 - x86 /lib/ld-linux.so.2
1281 - # mips
1282 - o32 /lib/ld.so.1
1283 - n32 /lib32/ld.so.1
1284 - n64 /lib64/ld.so.1
1285 - # powerpc
1286 - ppc /lib/ld.so.1
1287 - ppc64 /lib64/ld64.so.1
1288 - # riscv
1289 - ilp32d /lib/ld-linux-riscv32-ilp32d.so.1
1290 - ilp32 /lib/ld-linux-riscv32-ilp32.so.1
1291 - lp64d /lib/ld-linux-riscv64-lp64d.so.1
1292 - lp64 /lib/ld-linux-riscv64-lp64.so.1
1293 - # s390
1294 - s390 /lib/ld.so.1
1295 - s390x /lib/ld64.so.1
1296 - # sparc
1297 - sparc32 /lib/ld-linux.so.2
1298 - sparc64 /lib64/ld-linux.so.2
1299 - )
1300 - case $(tc-endian) in
1301 - little)
1302 - ldso_abi_list+=(
1303 - # arm
1304 - arm64 /lib/ld-linux-aarch64.so.1
1305 - )
1306 - ;;
1307 - big)
1308 - ldso_abi_list+=(
1309 - # arm
1310 - arm64 /lib/ld-linux-aarch64_be.so.1
1311 - )
1312 - ;;
1313 - esac
1314 - if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
1315 - dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
1316 - fi
1317 - for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
1318 - ldso_abi=${ldso_abi_list[i]}
1319 - has ${ldso_abi} $(get_install_abis) || continue
1320 -
1321 - ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
1322 - if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
1323 - dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
1324 - fi
1325 - done
1326 -
1327 - # With devpts under Linux mounted properly, we do not need the pt_chown
1328 - # binary to be setuid. This is because the default owners/perms will be
1329 - # exactly what we want.
1330 - if ! use suid ; then
1331 - find "${ED}" -name pt_chown -exec chmod -s {} +
1332 - fi
1333 -
1334 - #################################################################
1335 - # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
1336 - # Make sure we install some symlink hacks so that when we build
1337 - # a 2nd stage cross-compiler, gcc finds the target system
1338 - # headers correctly. See gcc/doc/gccinstall.info
1339 - if is_crosscompile ; then
1340 - # We need to make sure that /lib and /usr/lib always exists.
1341 - # gcc likes to use relative paths to get to its multilibs like
1342 - # /usr/lib/../lib64/. So while we don't install any files into
1343 - # /usr/lib/, we do need it to exist.
1344 - keepdir $(alt_prefix)/lib
1345 - keepdir $(alt_prefix)/usr/lib
1346 -
1347 - dosym usr/include $(alt_prefix)/sys-include
1348 - return 0
1349 - fi
1350 -
1351 - # Files for Debian-style locale updating
1352 - dodir /usr/share/i18n
1353 - sed \
1354 - -e "/^#/d" \
1355 - -e "/SUPPORTED-LOCALES=/d" \
1356 - -e "s: \\\\::g" -e "s:/: :g" \
1357 - "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
1358 - || die "generating /usr/share/i18n/SUPPORTED failed"
1359 - cd "${WORKDIR}"/extra/locale
1360 - dosbin locale-gen
1361 - doman *.[0-8]
1362 - insinto /etc
1363 - doins locale.gen
1364 -
1365 - # Make sure all the ABI's can find the locales and so we only
1366 - # have to generate one set
1367 - local a
1368 - keepdir /usr/$(get_libdir)/locale
1369 - for a in $(get_install_abis) ; do
1370 - if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
1371 - dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
1372 - fi
1373 - done
1374 -
1375 - # HACK: If we're building for riscv, we need to additionally make sure that
1376 - # we can find the locale archive afterwards
1377 - case ${CTARGET} in
1378 - riscv*)
1379 - if [[ ! -e ${ED}/usr/lib/locale ]] ; then
1380 - dosym ../$(get_libdir)/locale /usr/lib/locale
1381 - fi
1382 - ;;
1383 - *) ;;
1384 - esac
1385 -
1386 - cd "${S}"
1387 -
1388 - # Install misc network config files
1389 - insinto /etc
1390 - doins posix/gai.conf nss/nsswitch.conf
1391 -
1392 - # Gentoo-specific
1393 - newins "${FILESDIR}"/host.conf-1 host.conf
1394 -
1395 - if use nscd ; then
1396 - doins nscd/nscd.conf
1397 -
1398 - newinitd "$(prefixify_ro "${FILESDIR}"/nscd-1)" nscd
1399 -
1400 - local nscd_args=(
1401 - -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
1402 - )
1403 -
1404 - sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
1405 -
1406 - systemd_dounit nscd/nscd.service
1407 - systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
1408 - fi
1409 -
1410 - echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
1411 - doenvd "${T}"/00glibc
1412 -
1413 - for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
1414 - [[ -s ${d} ]] && dodoc ${d}
1415 - done
1416 - dodoc -r ChangeLog.old
1417 -
1418 - # Prevent overwriting of the /etc/localtime symlink. We'll handle the
1419 - # creation of the "factory" symlink in pkg_postinst().
1420 - rm -f "${ED}"/etc/localtime
1421 -
1422 - # Generate all locales if this is a native build as locale generation
1423 - if use compile-locales && ! is_crosscompile ; then
1424 - run_locale_gen --inplace-glibc "${ED}/"
1425 - sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
1426 - fi
1427 -}
1428 -
1429 -glibc_headers_install() {
1430 - local builddir=$(builddir "headers")
1431 - cd "${builddir}"
1432 - emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
1433 -
1434 - insinto $(alt_headers)/gnu
1435 - doins "${S}"/include/gnu/stubs.h
1436 -
1437 - # Make sure we install the sys-include symlink so that when
1438 - # we build a 2nd stage cross-compiler, gcc finds the target
1439 - # system headers correctly. See gcc/doc/gccinstall.info
1440 - dosym usr/include $(alt_prefix)/sys-include
1441 -}
1442 -
1443 -src_install() {
1444 - if just_headers ; then
1445 - export ABI=default
1446 - glibc_headers_install
1447 - return
1448 - fi
1449 -
1450 - foreach_abi glibc_do_src_install
1451 -
1452 - if ! use static-libs ; then
1453 - elog "Not installing static glibc libraries"
1454 - find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
1455 - fi
1456 -}
1457 -
1458 -# Simple test to make sure our new glibc isn't completely broken.
1459 -# Make sure we don't test with statically built binaries since
1460 -# they will fail. Also, skip if this glibc is a cross compiler.
1461 -#
1462 -# If coreutils is built with USE=multicall, some of these files
1463 -# will just be wrapper scripts, not actual ELFs we can test.
1464 -glibc_sanity_check() {
1465 - cd / #228809
1466 -
1467 - # We enter ${ED} so to avoid trouble if the path contains
1468 - # special characters; for instance if the path contains the
1469 - # colon character (:), then the linker will try to split it
1470 - # and look for the libraries in an unexpected place. This can
1471 - # lead to unsafe code execution if the generated prefix is
1472 - # within a world-writable directory.
1473 - # (e.g. /var/tmp/portage:${HOSTNAME})
1474 - pushd "${ED}"/$(get_libdir) >/dev/null
1475 -
1476 - local x striptest
1477 - for x in cal date env free ls true uname uptime ; do
1478 - x=$(type -p ${x})
1479 - [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
1480 - striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
1481 - case ${striptest} in
1482 - *"statically linked"*) continue;;
1483 - *"ASCII text"*) continue;;
1484 - esac
1485 - # We need to clear the locale settings as the upgrade might want
1486 - # incompatible locale data. This test is not for verifying that.
1487 - LC_ALL=C \
1488 - ./ld-*.so --library-path . ${x} > /dev/null \
1489 - || die "simple run test (${x}) failed"
1490 - done
1491 -
1492 - popd >/dev/null
1493 -}
1494 -
1495 -pkg_preinst() {
1496 - # nothing to do if just installing headers
1497 - just_headers && return
1498 -
1499 - # prepare /etc/ld.so.conf.d/ for files
1500 - mkdir -p "${EROOT}"/etc/ld.so.conf.d
1501 -
1502 - # Default /etc/hosts.conf:multi to on for systems with small dbs.
1503 - if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
1504 - sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
1505 - einfo "Defaulting /etc/host.conf:multi to on"
1506 - fi
1507 -
1508 - [[ -n ${ROOT} ]] && return 0
1509 - [[ -d ${ED}/$(get_libdir) ]] || return 0
1510 - [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
1511 -}
1512 -
1513 -pkg_postinst() {
1514 - # nothing to do if just installing headers
1515 - just_headers && return
1516 -
1517 - if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
1518 - # Generate fastloading iconv module configuration file.
1519 - "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
1520 - fi
1521 -
1522 - if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
1523 - use compile-locales || run_locale_gen "${EROOT}/"
1524 - fi
1525 -
1526 - # Check for sanity of /etc/nsswitch.conf, take 2
1527 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
1528 - local entry
1529 - for entry in passwd group shadow; do
1530 - if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then
1531 - ewarn ""
1532 - ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been"
1533 - ewarn "removed from glibc and is now provided by the package"
1534 - ewarn " sys-auth/libnss-nis"
1535 - ewarn "Install it now to keep your NIS setup working."
1536 - ewarn ""
1537 - fi
1538 - done
1539 - fi
1540 -}