diff options
Diffstat (limited to 'sys-libs/glibc')
-rw-r--r-- | sys-libs/glibc/Manifest | 8 | ||||
-rw-r--r-- | sys-libs/glibc/files/2.34/glibc-2.34-hppa-asm-getcontext-fixes.patch | 214 | ||||
-rw-r--r-- | sys-libs/glibc/files/host.conf-1 | 1 | ||||
-rw-r--r-- | sys-libs/glibc/glibc-2.35-r9.ebuild (renamed from sys-libs/glibc/glibc-2.33-r10.ebuild) | 403 |
4 files changed, 466 insertions, 160 deletions
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest index 9d2d29dc..07c8513c 100644 --- a/sys-libs/glibc/Manifest +++ b/sys-libs/glibc/Manifest @@ -1,4 +1,6 @@ DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347 -DIST glibc-2.33-patches-4.tar.xz 60124 BLAKE2B a7a99f39c16df241745772c31b10946dc44c51e6c09f8a447b905e7dd6ba529aee08f66a581431453c6665485ac1848861559aa3f0aaba8c2061c1f1eb77d9be SHA512 05c33dc465a98097f836783bb5037dfa14b3a2c0c140014f642ea72954222ae919fe2db9573ee70ca9c1881b3b59dd4b815a8f39f331494fa12951c9012797ef -DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb -DIST locale-gen-2.10.tar.gz 7747 BLAKE2B 49f569c5ae5260fca128503bc6f22d6f6f1cda817920c41fdadadf1527bbb4f3eb161f79fa729830666a4673e9092f99f4685ec8fcac8ddea0b8242bca9c1f4f SHA512 e350e60d458d67638e3090711fca05af6fafac06c51b97648244549f8a0621dab7543f09dc7ad4c62392f13bdae8e5875dc6d0b6c3d83efc29d116bc2eef92db +DIST glibc-2.35-loongarch-patches-20220522.tar.xz 44728 BLAKE2B 09e7a061f3269ebd763cd700f7c23e6cd7aab738d87ee31f76a81281920c4e5e207964c79104cd75f0a2e07b77344c2a730a9063344aa1483cd3d9aeac87de40 SHA512 21f13892fb52ec753856d5559b032c2be3a76d1cf940127222f7aa878548ce7e6ea0d2ff8791ddb91aaa2b77ce17131cd2fb2ebbdaa99443bf0a6b4c81f7388d +DIST glibc-2.35-patches-10.tar.xz 221864 BLAKE2B 083d06dd881aa262dcaea8db1b81f841bbe92bf53af3a83fa78d95d7c58522d41691682488051638f8ec5b0554a85565c9acd01c6b43cf23e6d860689e76fc4d SHA512 4c6f4a8a7406542438d44a2dbc601cb1d60fa850b39e93498a86965e038063dcd861a79256cb16d4c44386c25761f63114a4354999be94adb0f46ccb6927dce8 +DIST glibc-2.35.tar.xz 18165952 BLAKE2B 623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063 SHA512 e7336ce27561be5d7c217832a1136fb327e057bd8d3f92925b35c97e3e9f9e486948b5a1e03e5e4090772ef06437a074d10b82e68f17f1ad8f22077ee39e1b66 +DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238 +DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38 diff --git a/sys-libs/glibc/files/2.34/glibc-2.34-hppa-asm-getcontext-fixes.patch b/sys-libs/glibc/files/2.34/glibc-2.34-hppa-asm-getcontext-fixes.patch new file mode 100644 index 00000000..299a6dae --- /dev/null +++ b/sys-libs/glibc/files/2.34/glibc-2.34-hppa-asm-getcontext-fixes.patch @@ -0,0 +1,214 @@ +https://sourceware.org/git/?p=glibc.git;a=patch;h=738ee53f0ce5e39b9b7a6777f5d3057afbaac498 +https://sourceware.org/git/?p=glibc.git;a=patch;h=d53b9cc391c72a1011ea8fe7a9f70dc5060a0db2 + +From 738ee53f0ce5e39b9b7a6777f5d3057afbaac498 Mon Sep 17 00:00:00 2001 +From: John David Anglin <danglin@gcc.gnu.org> +Date: Tue, 15 Mar 2022 23:12:37 +0000 +Subject: [PATCH] hppa: Implement swapcontext in assembler (bug 28960) + +When swapcontext.c is compiled without -g, the following error occurs: +Error: CFI instruction used without previous .cfi_startproc + +Fix by converting swapcontext routine to assembler. +--- + sysdeps/unix/sysv/linux/hppa/swapcontext.S | 72 +++++++++++++++++++ + sysdeps/unix/sysv/linux/hppa/swapcontext.c | 83 ---------------------- + 2 files changed, 72 insertions(+), 83 deletions(-) + create mode 100644 sysdeps/unix/sysv/linux/hppa/swapcontext.S + delete mode 100644 sysdeps/unix/sysv/linux/hppa/swapcontext.c + +diff --git a/sysdeps/unix/sysv/linux/hppa/swapcontext.S b/sysdeps/unix/sysv/linux/hppa/swapcontext.S +new file mode 100644 +index 0000000000..94b164dc63 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/hppa/swapcontext.S +@@ -0,0 +1,72 @@ ++/* Swap to new context. ++ Copyright (C) 2008-2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ <https://www.gnu.org/licenses/>. */ ++ ++#include <sysdep.h> ++#include "ucontext_i.h" ++ ++ .text ++ENTRY(__swapcontext) ++ ++ /* Copy rp to ret0 (r28). */ ++ copy %rp,%ret0 ++ ++ /* Create a frame. */ ++ ldo 64(%sp),%sp ++ .cfi_def_cfa_offset -64 ++ ++ /* Save the current machine context to oucp. */ ++ bl __getcontext,%rp ++ ++ /* Copy oucp to register ret1 (r29). __getcontext saves and ++ restores it on a normal return. It is restored from oR29 ++ on reactivation. */ ++ copy %r26,%ret1 ++ ++ /* Pop frame. */ ++ ldo -64(%sp),%sp ++ .cfi_def_cfa_offset 0 ++ ++ /* Load return pointer from oR28. */ ++ ldw oR28(%ret1),%rp ++ ++ /* Return if error. */ ++ or,= %r0,%ret0,%r0 ++ bv,n %r0(%rp) ++ ++ /* Load sc_sar flag. */ ++ ldb oSAR(%ret1),%r20 ++ ++ /* Return if oucp context has been reactivated. */ ++ or,= %r0,%r20,%r0 ++ bv,n %r0(%rp) ++ ++ /* Mark sc_sar flag. */ ++ ldi 1,%r20 ++ stb %r20,oSAR(%ret1) ++ ++ /* Activate the machine context in ucp. */ ++ bl __setcontext,%rp ++ ldw oR25(%ret1),%r26 ++ ++ /* Load return pointer. */ ++ ldw oR28(%ret1),%rp ++ bv,n %r0(%rp) ++ ++PSEUDO_END(__swapcontext) ++ ++weak_alias (__swapcontext, swapcontext) +diff --git a/sysdeps/unix/sysv/linux/hppa/swapcontext.c b/sysdeps/unix/sysv/linux/hppa/swapcontext.c +deleted file mode 100644 +index 1664f68c7b..0000000000 +--- a/sysdeps/unix/sysv/linux/hppa/swapcontext.c ++++ /dev/null +@@ -1,83 +0,0 @@ +-/* Swap to new context. +- Copyright (C) 2008-2021 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Helge Deller <deller@gmx.de>, 2008. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library. If not, see +- <https://www.gnu.org/licenses/>. */ +- +-#include <ucontext.h> +-#include "ucontext_i.h" +- +-extern int __getcontext (ucontext_t *ucp); +-extern int __setcontext (const ucontext_t *ucp); +- +-int +-__swapcontext (ucontext_t *oucp, const ucontext_t *ucp) +-{ +- /* Save rp for debugger. */ +- asm ("stw %rp,-20(%sp)"); +- asm (".cfi_offset 2, -20"); +- +- /* Copy rp to ret0 (r28). */ +- asm ("copy %rp,%ret0"); +- +- /* Create a frame. */ +- asm ("ldo 64(%sp),%sp"); +- asm (".cfi_def_cfa_offset -64"); +- +- /* Save the current machine context to oucp. */ +- asm ("bl __getcontext,%rp"); +- +- /* Copy oucp to register ret1 (r29). __getcontext saves and restores it +- on a normal return. It is restored from oR29 on reactivation. */ +- asm ("copy %r26,%ret1"); +- +- /* Pop frame. */ +- asm ("ldo -64(%sp),%sp"); +- asm (".cfi_def_cfa_offset 0"); +- +- /* Load return pointer from oR28. */ +- asm ("ldw %0(%%ret1),%%rp" : : "i" (oR28)); +- +- /* Return if error. */ +- asm ("or,= %r0,%ret0,%r0"); +- asm ("bv,n %r0(%rp)"); +- +- /* Load sc_sar flag. */ +- asm ("ldb %0(%%ret1),%%r20" : : "i" (oSAR)); +- +- /* Return if oucp context has been reactivated. */ +- asm ("or,= %r0,%r20,%r0"); +- asm ("bv,n %r0(%rp)"); +- +- /* Mark sc_sar flag. */ +- asm ("1: ldi 1,%r20"); +- asm ("stb %%r20,%0(%%ret1)" : : "i" (oSAR)); +- +- /* Activate the machine context in ucp. */ +- asm ("bl __setcontext,%rp"); +- asm ("ldw %0(%%ret1),%%r26" : : "i" (oR25)); +- +- /* Load return pointer. */ +- asm ("ldw %0(%%ret1),%%rp" : : "i" (oR28)); +- +- /* A successful call to setcontext does not return. */ +- asm ("bv,n %r0(%rp)"); +- +- /* Make gcc happy. */ +- return 0; +-} +- +-weak_alias (__swapcontext, swapcontext) +-- +2.27.0 + + +From d53b9cc391c72a1011ea8fe7a9f70dc5060a0db2 Mon Sep 17 00:00:00 2001 +From: John David Anglin <danglin@gcc.gnu.org> +Date: Tue, 15 Mar 2022 23:04:39 +0000 +Subject: [PATCH] hppa: Use END instead of PSEUDO_END in swapcontext.S + +(cherry picked from commit 7a5c440102d4ec7fafd9bbd98eca9bd90ecaaafd) +--- + sysdeps/unix/sysv/linux/hppa/swapcontext.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/hppa/swapcontext.S b/sysdeps/unix/sysv/linux/hppa/swapcontext.S +index 94b164dc63..fbc22586d1 100644 +--- a/sysdeps/unix/sysv/linux/hppa/swapcontext.S ++++ b/sysdeps/unix/sysv/linux/hppa/swapcontext.S +@@ -67,6 +67,6 @@ ENTRY(__swapcontext) + ldw oR28(%ret1),%rp + bv,n %r0(%rp) + +-PSEUDO_END(__swapcontext) ++END(__swapcontext) + + weak_alias (__swapcontext, swapcontext) +-- +2.27.0 diff --git a/sys-libs/glibc/files/host.conf-1 b/sys-libs/glibc/files/host.conf-1 index 4c58e52d..661b4af5 100644 --- a/sys-libs/glibc/files/host.conf-1 +++ b/sys-libs/glibc/files/host.conf-1 @@ -1,5 +1,4 @@ # /etc/host.conf: -# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/host.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $ # The file /etc/host.conf contains configuration information specific to # the resolver library. It should contain one configuration keyword per diff --git a/sys-libs/glibc/glibc-2.33-r10.ebuild b/sys-libs/glibc/glibc-2.35-r9.ebuild index ec8e21d6..1ade6998 100644 --- a/sys-libs/glibc/glibc-2.33-r10.ebuild +++ b/sys-libs/glibc/glibc-2.35-r9.ebuild @@ -1,12 +1,15 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python3_{7,8,9,10} ) +# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc +# Please read & adapt the page as necessary if obsolete. + +PYTHON_COMPAT=( python3_{8..11} ) TMPFILES_OPTIONAL=1 -inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \ +inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \ multilib systemd multiprocessing tmpfiles DESCRIPTION="GNU libc C library" @@ -17,30 +20,38 @@ SLOT="2.2" EMULTILIB_PKG="true" # Gentoo patchset (ignored for live ebuilds) -PATCH_VER=4 +PATCH_VER=10 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then inherit git-r3 else - KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86" + # KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + KEYWORDS="~m68k" SRC_URI="mirror://gnu/glibc/${P}.tar.xz" SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz" + SRC_URI+=" experimental-loong? ( https://dev.gentoo.org/~xen0n/distfiles/glibc-2.35-loongarch-patches-20220522.tar.xz )" fi RELEASE_VER=${PV} GCC_BOOTSTRAP_VER=20201208 -LOCALE_GEN_VER=2.10 +LOCALE_GEN_VER=2.22 + +GLIBC_SYSTEMD_VER=20210729 SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz" SRC_URI+=" multilib-bootstrap? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" +SRC_URI+=" systemd? ( https://gitweb.gentoo.org/proj/toolchain/glibc-systemd.git/snapshot/glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz )" -IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs static-pie suid systemtap test vanilla" +IUSE="audit caps cet +clone3 compile-locales +crypt custom-cflags doc experimental-loong gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla" # Minimum kernel version that glibc requires MIN_KERN_VER="3.2.0" +# Minimum pax-utils version needed (which contains any new syscall changes for +# its seccomp filter!). Please double check this! +MIN_PAX_UTILS_VER="1.3.3" # Here's how the cross-compile logic breaks down ... # CTARGET - machine that will target the binaries @@ -94,7 +105,7 @@ fi BDEPEND=" ${PYTHON_DEPS} - >=app-misc/pax-utils-1.3.3 + >=app-misc/pax-utils-${MIN_PAX_UTILS_VER} sys-devel/bison doc? ( sys-apps/texinfo ) !compile-locales? ( @@ -126,7 +137,7 @@ RDEPEND="${COMMON_DEPEND} sys-apps/grep virtual/awk sys-apps/gentoo-functions - !<app-misc/pax-utils-1.3.3 + !<app-misc/pax-utils-${MIN_PAX_UTILS_VER} !<net-misc/openssh-8.1_p1-r2 " @@ -135,13 +146,13 @@ RESTRICT="!test? ( test )" if [[ ${CATEGORY} == cross-* ]] ; then BDEPEND+=" !headers-only? ( >=${CATEGORY}/binutils-2.27 - >=${CATEGORY}/gcc-6 + >=${CATEGORY}/gcc-6.2 )" [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" else BDEPEND+=" >=sys-devel/binutils-2.27 - >=sys-devel/gcc-6 + >=sys-devel/gcc-6.2 " DEPEND+=" virtual/os-headers " RDEPEND+=" @@ -157,18 +168,16 @@ GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}" # The following tests fail due to the Gentoo build system and are thus # executed but ignored: XFAIL_TEST_LIST=( - # 9) Failures of unknown origin - tst-latepthread - # buggy test, assumes /dev/ and /dev/null on a single filesystem # 'mount --bind /dev/null /chroot/dev/null' breaks it. # https://sourceware.org/PR25909 tst-support_descriptors - # Flaky test, known to fail occasionally: - # https://sourceware.org/PR19329 - # https://bugs.gentoo.org/719674#c12 - tst-stack4 + # The following tests fail only inside portage + # https://bugs.gentoo.org/831267 + tst-system + tst-strerror + tst-strsignal ) # @@ -241,8 +250,8 @@ do_compile_test() { rm -f glibc-test* printf '%b' "$*" > glibc-test.c - # Most of the time CC is already set, but not in early sanity checks. - nonfatal emake glibc-test CC="${CC-$(tc-getCC ${CTARGET})}" + # We assume CC is already set up. + nonfatal emake glibc-test ret=$? popd >/dev/null @@ -297,22 +306,33 @@ setup_target_flags() { export CFLAGS="-march=${t} ${CFLAGS}" einfo "Auto adding -march=${t} to CFLAGS #185404" fi + # For compatibility with older binaries at slight performance cost. + use stack-realign && export CFLAGS+=" -mstackrealign" ;; amd64) # -march needed for #185404 #199334 # TODO: See cross-compile issues listed above for x86. - [[ ${ABI} == x86 ]] && - 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 - local t=${CTARGET_OPT:-${CTARGET}} - t=${t%%-*} - # Normally the target is x86_64-xxx, so turn that into the -march that - # gcc actually accepts. #528708 - [[ ${t} == "x86_64" ]] && t="x86-64" - filter-flags '-march=*' - # ugly, ugly, ugly. ugly. - CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") - export CFLAGS_x86="${CFLAGS_x86} -march=${t}" - einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})" + if [[ ${ABI} == x86 ]]; then + 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 + local t=${CTARGET_OPT:-${CTARGET}} + t=${t%%-*} + # Normally the target is x86_64-xxx, so turn that into the -march that + # gcc actually accepts. #528708 + [[ ${t} == "x86_64" ]] && t="x86-64" + filter-flags '-march=*' + # ugly, ugly, ugly. ugly. + CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") + export CFLAGS_x86="${CFLAGS_x86} -march=${t}" + einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})" + fi + # For compatibility with older binaries at slight performance cost. + use stack-realign && export CFLAGS_x86+=" -mstackrealign" + + # Workaround for bug #823780. + if tc-is-gcc && (($(gcc-major-version) == 11)) && (($(gcc-minor-version) <= 2)) && (($(gcc-micro-version) == 0)) ; then + export CFLAGS_x86="${CFLAGS_x86} -mno-avx512f" + einfo "Auto adding -mno-avx512f to CFLAGS_x86 for buggy GCC version (bug #823780) (ABI=${ABI})" + fi fi ;; mips) @@ -388,6 +408,7 @@ setup_flags() { filter-flags '-O?' append-flags -O2 fi + strip-unsupported-flags filter-flags -m32 -m64 '-mabi=*' @@ -401,6 +422,9 @@ setup_flags() { # #492892 filter-flags -frecord-gcc-switches + # #829583 + filter-lfs-flags + unset CBUILD_OPT CTARGET_OPT if use multilib ; then CTARGET_OPT=$(get_abi_CTARGET) @@ -418,33 +442,9 @@ setup_flags() { replace-flags -O0 -O1 filter-flags '-fstack-protector*' -} -want_tls() { - # Archs that can use TLS (Thread Local Storage) - case $(tc-arch) in - x86) - # requires i486 or better #106556 - [[ ${CTARGET} == i[4567]86* ]] && return 0 - return 1 - ;; - esac - return 0 -} - -want__thread() { - want_tls || return 1 - - # For some reason --with-tls --with__thread is causing segfaults on sparc32. - [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 - - [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} - - # only test gcc -- can't test linking yet - tc-has-tls -c ${CTARGET} - WANT__THREAD=$? - - return ${WANT__THREAD} + # See end of bug #830454; we handle this via USE=cet + filter-flags '-fcf-protection=' } use_multiarch() { @@ -502,14 +502,106 @@ setup_env() { einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." return 0 fi - local VAR=CFLAGS_${ABI} + + # Glibc does not work with gold (for various reasons) #269274. + tc-ld-disable-gold + + if use doc ; then + export MAKEINFO=makeinfo + else + export MAKEINFO=/dev/null + fi + + # Reset CC and CXX to the value at start of emerge + export CC=${__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}} + export CXX=${__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}} + + # and make sure __ORIC_CC and __ORIG_CXX is defined now. + export __ORIG_CC=${CC} + export __ORIG_CXX=${CXX} + + if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then + + # If we are running in an otherwise clang/llvm environment, we need to + # recover the proper gcc and binutils settings here, at least until glibc + # is finally building with clang. So let's override everything that is + # set in the clang profiles. + # Want to shoot yourself into the foot? Set USE=custom-cflags, that's always + # a good start into that direction. + # Also, if you're crosscompiling, let's assume you know what you are doing. + # Hopefully. + # Last, we need the settings of the *build* environment, not of the + # target environment... + + local current_binutils_path=$(env ROOT="${BROOT}" binutils-config -B) + local current_gcc_path=$(env ROOT="${BROOT}" gcc-config -B) + einfo "Overriding clang configuration, since it won't work here" + + export CC="${current_gcc_path}/gcc" + export CXX="${current_gcc_path}/g++" + export LD="${current_binutils_path}/ld.bfd" + export AR="${current_binutils_path}/ar" + export AS="${current_binutils_path}/as" + export NM="${current_binutils_path}/nm" + export STRIP="${current_binutils_path}/strip" + export RANLIB="${current_binutils_path}/ranlib" + export OBJCOPY="${current_binutils_path}/objcopy" + export STRINGS="${current_binutils_path}/strings" + export OBJDUMP="${current_binutils_path}/objdump" + export READELF="${current_binutils_path}/readelf" + export ADDR2LINE="${current_binutils_path}/addr2line" + + # do we need to also do flags munging here? yes! at least... + filter-flags '-fuse-ld=*' + filter-flags '-D_FORTIFY_SOURCE=*' + + else + + # this is the "normal" case + + export CC="$(tc-getCC ${CTARGET})" + export CXX="$(tc-getCXX ${CTARGET})" + + # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure + # can't detect them automatically due to ${CHOST} mismatch and fallbacks + # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup(). + export NM="$(tc-getNM ${CTARGET})" + export READELF="$(tc-getREADELF ${CTARGET})" + + fi + # We need to export CFLAGS with abi information in them because glibc's # configure script checks CFLAGS for some targets (like mips). Keep # around the original clean value to avoid appending multiple ABIs on - # top of each other. - : ${__GLIBC_CC:=$(tc-getCC ${CTARGET})} - export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" - einfo " $(printf '%15s' 'Manual CC:') ${CC}" + # top of each other. (Why does the comment talk about CFLAGS if the code + # acts on CC?) + export __GLIBC_CC=${CC} + export __GLIBC_CXX=${CXX} + + export __abi_CFLAGS="$(get_abi_CFLAGS)" + + # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 + # To build .S (assembly) files with the same ABI-specific flags + # upstream currently recommends adding CFLAGS to CC/CXX: + # https://sourceware.org/PR23273 + # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS + # and breaks multiarch support. See 659030#c3 for an example. + # The glibc configure script doesn't properly use LDFLAGS all the time. + export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}" + + # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 + export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}" + + if is_crosscompile; then + # Assume worst-case bootstrap: glibc is buil first time + # when ${CTARGET}-g++ is not available yet. We avoid + # building auxiliary programs that require C++: bug #683074 + # It should not affect final result. + export libc_cv_cxx_link_ok=no + # The line above has the same effect. We set CXX explicitly + # to make build logs less confusing. + export CXX= + fi } foreach_abi() { @@ -657,7 +749,7 @@ sanity_prechecks() { ebegin "Checking that IA32 emulation is enabled in the running kernel" echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" local STAT - if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then + if ${CC-${CHOST}-gcc} ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then "${T}/check-ia32-emulation.elf32" STAT=$? else @@ -674,13 +766,13 @@ sanity_prechecks() { fi # When we actually have to compile something... - if ! just_headers ; then - ebegin "Checking gcc for __thread support" - if ! eend $(want__thread ; echo $?) ; then - echo - eerror "Could not find a gcc that supports the __thread directive!" - eerror "Please update your binutils/gcc and try again." - die "No __thread support in gcc!" + if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then + if [[ -d "${ESYSROOT}"/usr/lib/include ]] ; then + # bug #833620, bug #643302 + eerror "Found ${ESYSROOT}/usr/lib/include directory!" + eerror "This is known to break glibc's build." + eerror "Please backup its contents then remove the directory." + die "Found directory (${ESYSROOT}/usr/lib/include) which will break build (bug #833620)!" fi if [[ ${CTARGET} == *-linux* ]] ; then @@ -710,6 +802,21 @@ sanity_prechecks() { fi } +upgrade_warning() { + if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then + local oldv newv=$(ver_cut 1-2 ${PV}) + for oldv in ${REPLACING_VERSIONS}; do + if ver_test ${oldv} -lt ${newv}; then + ewarn "After upgrading glibc, please restart all running processes." + ewarn "Be sure to include init (telinit u) or systemd (systemctl daemon-reexec)." + ewarn "Alternatively, reboot your system." + ewarn "(See bug #660556, bug #741116, bug #823756, etc)" + break + fi + done + fi +} + # # the phases # @@ -717,9 +824,7 @@ sanity_prechecks() { # pkg_pretend pkg_pretend() { - # All the checks... - einfo "Checking general environment sanity." - sanity_prechecks + upgrade_warning } pkg_setup() { @@ -730,13 +835,13 @@ pkg_setup() { # src_unpack src_unpack() { - # Consistency is not guaranteed between pkg_ and src_ ... + setup_env + + einfo "Checking general environment sanity." sanity_prechecks use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz - setup_env - if [[ ${PV} == 9999* ]] ; then EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/glibc-patches.git" EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git @@ -751,10 +856,12 @@ src_unpack() { cd "${WORKDIR}" || die unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz + use experimental-loong && unpack glibc-2.35-loongarch-patches-20220522.tar.xz fi cd "${WORKDIR}" || die unpack locale-gen-${LOCALE_GEN_VER}.tar.gz + use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz } src_prepare() { @@ -768,6 +875,20 @@ src_prepare() { einfo "Applying Gentoo Glibc Patchset ${patchsetname}" eapply "${WORKDIR}"/patches einfo "Done." + + if use experimental-loong ; then + einfo "Applying experimental LoongArch patchset" + eapply "${WORKDIR}"/loongarch-2.35 + einfo "Done." + fi + fi + + if use clone3 ; then + append-cppflags -DGENTOO_USE_CLONE3 + else + # See e.g. bug #827386, bug #819045. + elog "Disabling the clone3 syscall for compatibility with older Electron apps." + elog "Please re-enable this flag before filing bugs!" fi default @@ -790,78 +911,18 @@ src_prepare() { } glibc_do_configure() { - # Glibc does not work with gold (for various reasons) #269274. - tc-ld-disable-gold - - # CXX isnt handled by the multilib system, so if we dont unset here - # we accumulate crap across abis - unset CXX - - einfo "Configuring glibc for nptl" - - if use doc ; then - export MAKEINFO=makeinfo - else - export MAKEINFO=/dev/null - fi local v - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do + for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM AR AS STRIP RANLIB OBJCOPY STRINGS OBJDUMP READELF; do einfo " $(printf '%15s' ${v}:) ${!v}" done - # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 - # To build .S (assembly) files with the same ABI-specific flags - # upstream currently recommends adding CFLAGS to CC/CXX: - # https://sourceware.org/PR23273 - # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS - # and breaks multiarch support. See 659030#c3 for an example. - # The glibc configure script doesn't properly use LDFLAGS all the time. - export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" - einfo " $(printf '%15s' 'Manual CC:') ${CC}" - - # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 - export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" - - if is_crosscompile; then - # Assume worst-case bootstrap: glibc is buil first time - # when ${CTARGET}-g++ is not available yet. We avoid - # building auxiliary programs that require C++: bug #683074 - # It should not affect final result. - export libc_cv_cxx_link_ok=no - # The line above has the same effect. We set CXX explicitly - # to make build logs less confusing. - export CXX= - fi - einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" - - # Always use tuple-prefixed toolchain. For non-native ABI glibc's configure - # can't detect them automatically due to ${CHOST} mismatch and fallbacks - # to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup(). - export NM="$(tc-getNM ${CTARGET})" - export READELF="$(tc-getREADELF ${CTARGET})" - einfo " $(printf '%15s' 'Manual NM:') ${NM}" - einfo " $(printf '%15s' 'Manual READELF:') ${READELF}" - echo - local myconf=() - case ${CTARGET} in - m68k*) - # setjmp() is not compatible with stack protection: - # https://sourceware.org/PR24202 - myconf+=( --enable-stack-protector=no ) - ;; - *) - # Use '=strong' instead of '=all' to protect only functions - # worth protecting from stack smashes. - # '=all' is also known to have a problem in IFUNC resolution - # tests: https://sourceware.org/PR25680, bug #712356. - myconf+=( --enable-stack-protector=$(usex ssp strong no) ) - ;; - esac - myconf+=( --enable-stackguard-randomization ) + # Use '=strong' instead of '=all' to protect only functions + # worth protecting from stack smashes. + myconf+=( --enable-stack-protector=$(usex ssp strong no) ) # Keep a whitelist of targets supporing IFUNC. glibc's ./configure # is not robust enough to detect proper support: @@ -911,7 +972,6 @@ glibc_do_configure() { fi myconf+=( - --without-cvs --disable-werror --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} @@ -930,7 +990,6 @@ glibc_do_configure() { --with-pkgversion="$(glibc_banner)" $(use_enable crypt) $(use_multiarch || echo --disable-multi-arch) - $(use_enable static-pie) $(use_enable systemtap) $(use_enable nscd) @@ -962,11 +1021,6 @@ glibc_do_configure() { export libc_cv_rootsbindir="$(host_eprefix)/sbin" export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)" - # We take care of patching our binutils to use both hash styles, - # and many people like to force gnu hash style only, so disable - # this overriding check. #347761 - export libc_cv_hashstyle=no - local builddir=$(builddir nptl) mkdir -p "${builddir}" cd "${builddir}" @@ -1083,13 +1137,13 @@ glibc_headers_configure() { myconf+=( --disable-sanity-checks --enable-hacker-mode - --without-cvs --disable-werror --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} --with-headers=$(build_eprefix)$(alt_build_headers) --prefix="$(host_eprefix)/usr" + $(use_enable crypt) ${EXTRA_ECONF} ) @@ -1150,7 +1204,10 @@ glibc_src_test() { # sandbox does not understand unshare() and prevents # writes to /proc/, which makes many tests fail - SANDBOX_ON=0 LD_PRELOAD= emake ${myxfailparams} check + # we give the tests a bit more time to avoid spurious + # bug reports on slow arches + + SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=16 emake ${myxfailparams} check } do_src_test() { @@ -1183,13 +1240,13 @@ run_locale_gen() { root="$2" fi - local locale_list="${root}/etc/locale.gen" + local locale_list="${root%/}/etc/locale.gen" pushd "${ED}"/$(get_libdir) >/dev/null if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space" - locale_list="${root}/usr/share/i18n/SUPPORTED" + locale_list="${root%/}/usr/share/i18n/SUPPORTED" fi set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \ @@ -1362,7 +1419,13 @@ glibc_do_src_install() { # Install misc network config files insinto /etc - doins posix/gai.conf nss/nsswitch.conf + doins posix/gai.conf + + if use systemd ; then + doins "${WORKDIR}/glibc-systemd-${GLIBC_SYSTEMD_VER}/gentoo-config/nsswitch.conf" + else + doins nss/nsswitch.conf + fi # Gentoo-specific newins "${FILESDIR}"/host.conf-1 host.conf @@ -1378,7 +1441,7 @@ glibc_do_src_install() { sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd - systemd_dounit nscd/nscd.service + use systemd && systemd_dounit nscd/nscd.service newtmpfiles nscd/nscd.tmpfiles nscd.conf fi @@ -1448,6 +1511,12 @@ glibc_sanity_check() { # (e.g. /var/tmp/portage:${HOSTNAME}) pushd "${ED}"/$(get_libdir) >/dev/null + # first let's find the actual dynamic linker here + # symlinks may point to the wrong abi + local newldso=$(find . -maxdepth 1 -name 'ld*so.?' -type f -print -quit) + + einfo Last-minute run tests with ${newldso} in /$(get_libdir) ... + local x striptest for x in cal date env free ls true uname uptime ; do x=$(type -p ${x}) @@ -1460,7 +1529,7 @@ glibc_sanity_check() { # We need to clear the locale settings as the upgrade might want # incompatible locale data. This test is not for verifying that. LC_ALL=C \ - ./ld-*.so --library-path . ${x} > /dev/null \ + ${newldso} --library-path . ${x} > /dev/null \ || die "simple run test (${x}) failed" done @@ -1489,6 +1558,16 @@ pkg_preinst() { # https://bugs.gentoo.org/753740 rm "${EROOT}"/usr/lib/locale || die fi + + # Keep around libcrypt so that Perl doesn't break when merging libxcrypt + # (libxcrypt is the new provider for now of libcrypt.so.{1,2}). + # bug #802207 + if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then + PRESERVED_OLD_LIBCRYPT=1 + cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die + else + PRESERVED_OLD_LIBCRYPT=0 + fi } pkg_postinst() { @@ -1504,11 +1583,13 @@ pkg_postinst() { use compile-locales || run_locale_gen "${EROOT}/" fi + upgrade_warning + # Check for sanity of /etc/nsswitch.conf, take 2 if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then local entry for entry in passwd group shadow; do - if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then + if grep -E -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then ewarn "" ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" ewarn "removed from glibc and is now provided by the package" @@ -1518,4 +1599,14 @@ pkg_postinst() { fi done fi + + if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then + cp -p "${T}/libcrypt$(get_libname 1)" "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" || die + preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1) + + elog "Please ignore a possible later error message about a file collision involving" + elog "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1). We need to preserve this file for the moment to keep" + elog "the upgrade working, but it also needs to be overwritten when" + elog "sys-libs/libxcrypt is installed. See bug 802210 for more details." + fi } |