sys-libs/glibc: Sync with Gentoo

It's from Gentoo commit a3d93f81ed9442703de09b684f309d8e1d596571.
This commit is contained in:
Krzesimir Nowak 2022-10-05 15:42:15 +02:00
parent 4b3823890d
commit f2f8da03f9
7 changed files with 52 additions and 83 deletions

View File

@ -1,5 +1,5 @@
DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347 DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347
DIST glibc-2.33-patches-11.tar.xz 143916 BLAKE2B ac13b3ccf9681bb6d3c35ecc33e268ea3f67c1809f916019e692dc83e3ce809402a45548da5ca6c7c30d2a45a2638f9fa4254c0355bd4c53bdb216f17aa4e28b SHA512 0ee1dfcf9574543d49ab4fbfe53571258422b6e82b9d12a33e411cee7e517821a4c45c24962b5120783a4efc898afdfa170d33486cc74d94c526bdd14cc84300 DIST glibc-2.34-patches-17.tar.xz 241584 BLAKE2B e4eea130c331f64ba66e14a6ba318853141ee3e41b455cb45b8fdb702cae071dd307229dafcfcafcc41e5a56982f52c87e31d95295f824f1a2ae689a7e0f5b49 SHA512 c6a51b373be3986e1ad753541ccf73f29515b5df0f80e0450b26bed37e8c505e22e8f13e89554347e551819c8d89d30f306464e5d25cafa4a12400c112578dca
DIST glibc-2.33.tar.xz 17031280 BLAKE2B 703d12121c1e2c5d9e0c6ba5341f5fb5c4d9111611a83f2360029b5de9c6e5a5611249d1833684a58ed4afdf49cae614365d87ec8721ba0e5d218f593b1f229d SHA512 4cb5777b68b22b746cc51669e0e9282b43c83f6944e42656e6db7195ebb68f2f9260f130fdeb4e3cfc64efae4f58d96c43d388f52be1eb024ca448084684abdb DIST glibc-2.34.tar.xz 17301232 BLAKE2B 874031192f2f5a3b35c3f5b044a467d4be4e67e8593e070e5b49b901ce8ea6bde2f8d2f6c92fa33b3f61eb723572a9e5f2b45e56064168df80a96d3fdb6fa30c SHA512 15252affd9ef4523a8001db16d497f4fdcb3ddf4cde7fe80e075df0bd3cc6524dc29fbe20229dbf5f97af580556e6b1fac0de321a5fe25322bc3e72f93beb624
DIST glibc-systemd-20210814.tar.gz 1469 BLAKE2B 10fa7bcb46d4fdce9c0ab353cbd30871e9b09a347a13a9c9a3b5777f931aa3c826c158d2e49532c604d4a834f2fab4089b67495fb88d0398945dc50d45ad9ef1 SHA512 5346a9ea459a1e6ccf665389f2a294de1e16f1e3e05cdf07e3dd99ed0e4f6f8b52cc333d4bff3c75ac90ab6ce70cd4ab2b3e126f920ce7979abd6dda56315efc DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238
DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38 DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38

View File

@ -1,9 +0,0 @@
# GLibc
The system's C library, sometimes referred to as "service pack for the C
language". The build recipe has a single modification over the one Gentoo
upstream uses: in the installation callback `glibc_do_src_install`, we remove
all of glibc's `/etc` files right after the stock glibc build diligently
installed them, since we ship our own `/etc` stuff via the `baseimage` recipe.
The addition sits at the end of the `glibc_do_src_install` function and is duly
labelled `## Flatcar Container Linux: ...`.

View File

@ -1,2 +0,0 @@
L /etc/nscd.conf - - - - ../usr/share/baselayout/nscd.conf
d /var/db/nscd - - - - -

View File

@ -1,15 +0,0 @@
[Unit]
Description=Name Service Cache Daemon
After=network.target
[Service]
ExecStart=/usr/sbin/nscd -F
ExecStop=/usr/sbin/nscd --shutdown
ExecReload=/usr/sbin/nscd -i passwd
ExecReload=/usr/sbin/nscd -i group
ExecReload=/usr/sbin/nscd -i hosts
ExecReload=/usr/sbin/nscd -i services
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +0,0 @@
# Configuration to create /run/nscd directory
# Used as part of systemd's tmpfiles
d /run/nscd 0755 root root

View File

@ -6,10 +6,7 @@ EAPI=7
# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
# Please read & adapt the page as necessary if obsolete. # Please read & adapt the page as necessary if obsolete.
# We avoid Python 3.10 here _for now_ (it does work!) to avoid circular dependencies PYTHON_COMPAT=( python3_{8..10} )
# on upgrades as people migrate to libxcrypt.
# https://wiki.gentoo.org/wiki/User:Sam/Portage_help/Circular_dependencies#Python_and_libcrypt
PYTHON_COMPAT=( python3_{8,9} )
TMPFILES_OPTIONAL=1 TMPFILES_OPTIONAL=1
inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \ inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
@ -23,7 +20,7 @@ SLOT="2.2"
EMULTILIB_PKG="true" EMULTILIB_PKG="true"
# Gentoo patchset (ignored for live ebuilds) # Gentoo patchset (ignored for live ebuilds)
PATCH_VER=11 PATCH_VER=17
PATCH_DEV=dilfridge PATCH_DEV=dilfridge
if [[ ${PV} == 9999* ]]; then if [[ ${PV} == 9999* ]]; then
@ -40,16 +37,19 @@ GCC_BOOTSTRAP_VER=20201208
LOCALE_GEN_VER=2.22 LOCALE_GEN_VER=2.22
GLIBC_SYSTEMD_VER=20210814 GLIBC_SYSTEMD_VER=20210729
SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz" 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+=" 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 )" 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 systemd systemtap test vanilla" IUSE="audit caps cet +clone3 compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs static-pie suid systemd systemtap test vanilla"
# Minimum kernel version that glibc requires # Minimum kernel version that glibc requires
MIN_KERN_VER="3.2.0" 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 ... # Here's how the cross-compile logic breaks down ...
# CTARGET - machine that will target the binaries # CTARGET - machine that will target the binaries
@ -103,7 +103,7 @@ fi
BDEPEND=" BDEPEND="
${PYTHON_DEPS} ${PYTHON_DEPS}
>=app-misc/pax-utils-1.3.1 >=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
sys-devel/bison sys-devel/bison
doc? ( sys-apps/texinfo ) doc? ( sys-apps/texinfo )
!compile-locales? ( !compile-locales? (
@ -135,7 +135,7 @@ RDEPEND="${COMMON_DEPEND}
sys-apps/grep sys-apps/grep
virtual/awk virtual/awk
sys-apps/gentoo-functions sys-apps/gentoo-functions
!<app-misc/pax-utils-1.3.1 !<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
!<net-misc/openssh-8.1_p1-r2 !<net-misc/openssh-8.1_p1-r2
" "
@ -166,19 +166,11 @@ GENTOO_GLIBC_XFAIL_TESTS="${GENTOO_GLIBC_XFAIL_TESTS:-yes}"
# The following tests fail due to the Gentoo build system and are thus # The following tests fail due to the Gentoo build system and are thus
# executed but ignored: # executed but ignored:
XFAIL_TEST_LIST=( XFAIL_TEST_LIST=(
# 9) Failures of unknown origin
tst-latepthread
# buggy test, assumes /dev/ and /dev/null on a single filesystem # buggy test, assumes /dev/ and /dev/null on a single filesystem
# 'mount --bind /dev/null /chroot/dev/null' breaks it. # 'mount --bind /dev/null /chroot/dev/null' breaks it.
# https://sourceware.org/PR25909 # https://sourceware.org/PR25909
tst-support_descriptors 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 # The following tests fail only inside portage
# https://bugs.gentoo.org/831267 # https://bugs.gentoo.org/831267
tst-system tst-system
@ -329,6 +321,14 @@ setup_target_flags() {
export CFLAGS_x86="${CFLAGS_x86} -march=${t}" export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})" einfo "Auto adding -march=${t} to CFLAGS_x86 #185404 (ABI=${ABI})"
fi fi
# Workaround for https://bugs.gentoo.org/823780. This really should
# be removed when the upstream bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103275
# is fixed in our tree, either via 11.3 or an 11.2p2 patch set.
if [[ ${ABI} == x86 ]] && 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 (bug #823780) (ABI=${ABI})"
fi
;; ;;
mips) mips)
# The mips abi cannot support the GNU style hashes. #233233 # The mips abi cannot support the GNU style hashes. #233233
@ -403,6 +403,7 @@ setup_flags() {
filter-flags '-O?' filter-flags '-O?'
append-flags -O2 append-flags -O2
fi fi
strip-unsupported-flags strip-unsupported-flags
filter-flags -m32 -m64 '-mabi=*' filter-flags -m32 -m64 '-mabi=*'
@ -436,6 +437,9 @@ setup_flags() {
replace-flags -O0 -O1 replace-flags -O0 -O1
filter-flags '-fstack-protector*' filter-flags '-fstack-protector*'
# See end of bug #830454; we handle this via USE=cet
filter-flags '-fcf-protection='
} }
use_multiarch() { use_multiarch() {
@ -521,9 +525,11 @@ setup_env() {
# a good start into that direction. # a good start into that direction.
# Also, if you're crosscompiling, let's assume you know what you are doing. # Also, if you're crosscompiling, let's assume you know what you are doing.
# Hopefully. # Hopefully.
# Last, we need the settings of the *build* environment, not of the
# target environment...
local current_binutils_path=$(binutils-config -B) local current_binutils_path=$(env ROOT="${BROOT}" binutils-config -B)
local current_gcc_path=$(gcc-config -B) local current_gcc_path=$(env ROOT="${BROOT}" gcc-config -B)
einfo "Overriding clang configuration, since it won't work here" einfo "Overriding clang configuration, since it won't work here"
export CC="${current_gcc_path}/gcc" export CC="${current_gcc_path}/gcc"
@ -756,6 +762,14 @@ sanity_prechecks() {
# When we actually have to compile something... # When we actually have to compile something...
if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then 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 if [[ ${CTARGET} == *-linux* ]] ; then
local run_kv build_kv want_kv local run_kv build_kv want_kv
@ -791,6 +805,7 @@ upgrade_warning() {
ewarn "After upgrading glibc, please restart all running processes." ewarn "After upgrading glibc, please restart all running processes."
ewarn "Be sure to include init (telinit u) or systemd (systemctl daemon-reexec)." ewarn "Be sure to include init (telinit u) or systemd (systemctl daemon-reexec)."
ewarn "Alternatively, reboot your system." ewarn "Alternatively, reboot your system."
ewarn "(See bug #660556, bug #741116, bug #823756, etc)"
break break
fi fi
done done
@ -803,12 +818,10 @@ upgrade_warning() {
# pkg_pretend # pkg_pretend
# Flatcar: Skip sanity checks at pretend time because we don't ship a compiler
# in the OS image. This test fails when installing the glibc binpkg and no
# compiler is present.
pkg_pretend() { pkg_pretend() {
einfo "Flatcar: Skipping sanity_prechecks for binpkg installation. src_unpack will take care of compile-time prechecks." # All the checks...
# sanity_prechecks einfo "Checking general environment sanity."
sanity_prechecks
upgrade_warning upgrade_warning
} }
@ -861,6 +874,14 @@ src_prepare() {
einfo "Done." 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 default
gnuconfig_update gnuconfig_update
@ -1005,11 +1026,6 @@ glibc_do_configure() {
export libc_cv_rootsbindir="$(host_eprefix)/sbin" export libc_cv_rootsbindir="$(host_eprefix)/sbin"
export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)" 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) local builddir=$(builddir nptl)
mkdir -p "${builddir}" mkdir -p "${builddir}"
cd "${builddir}" cd "${builddir}"
@ -1261,13 +1277,12 @@ glibc_do_src_install() {
# '#define VERSION "2.26.90"' -> '2.26.90' # '#define VERSION "2.26.90"' -> '2.26.90'
local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
# Flatcar: override this and strip everything to keep image size at bay
# Avoid stripping binaries not targeted by ${CHOST}. Or else # Avoid stripping binaries not targeted by ${CHOST}. Or else
# ${CHOST}-strip would break binaries build for ${CTARGET}. # ${CHOST}-strip would break binaries build for ${CTARGET}.
# is_crosscompile && dostrip -x / is_crosscompile && dostrip -x /
# gdb thread introspection relies on local libpthreas symbols. stripping breaks it # gdb thread introspection relies on local libpthreas symbols. stripping breaks it
# See Note [Disable automatic stripping] # See Note [Disable automatic stripping]
# dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
# Move versioned .a file out of libdir to evade portage QA checks # Move versioned .a file out of libdir to evade portage QA checks
@ -1450,23 +1465,6 @@ glibc_do_src_install() {
run_locale_gen --inplace-glibc "${ED}/" run_locale_gen --inplace-glibc "${ED}/"
sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
fi fi
## Flatcar Container Linux: Add some local changes:
# - Config files are installed by baselayout, not glibc.
# - Install nscd/systemd stuff in /usr.
# Use tmpfiles to put nscd.conf in /etc and create directories.
insinto /usr/share/baselayout
if ! in_iuse nscd || use nscd ; then
doins "${S}"/nscd/nscd.conf || die
newtmpfiles "${FILESDIR}"/nscd-conf.tmpfiles nscd-conf.conf || die
fi
# Clean out any default configs.
rm -rf "${ED}"/etc
# Restore this one for the SDK.
test ! -e "${T}"/00glibc || doenvd "${T}"/00glibc
} }
glibc_headers_install() { glibc_headers_install() {
@ -1518,7 +1516,7 @@ glibc_sanity_check() {
# first let's find the actual dynamic linker here # first let's find the actual dynamic linker here
# symlinks may point to the wrong abi # symlinks may point to the wrong abi
local newldso=$(find . -maxdepth 1 -name 'ld-*so' -type f -print -quit) local newldso=$(find . -maxdepth 1 -name 'ld*so.?' -type f -print -quit)
einfo Last-minute run tests with ${newldso} in /$(get_libdir) ... einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...

View File

@ -13,6 +13,7 @@
<flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag> <flag name="debug">When USE=hardened, allow fortify/stack violations to dump core (SIGABRT) and not kill self (SIGKILL)</flag>
<flag name="experimental-loong">Add experimental LoongArch patchset</flag> <flag name="experimental-loong">Add experimental LoongArch patchset</flag>
<flag name="gd">build memusage and memusagestat tools</flag> <flag name="gd">build memusage and memusagestat tools</flag>
<flag name="hash-sysv-compat">enable sysv linker hashes in glibc for compatibility with binary software (EAC via wine/proton)</flag>
<flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag> <flag name="multiarch">enable optimizations for multiple CPU architectures (detected at runtime)</flag>
<flag name="multilib-bootstrap">Provide prebuilt libgcc.a and crt files if missing. Only needed for ABI switch.</flag> <flag name="multilib-bootstrap">Provide prebuilt libgcc.a and crt files if missing. Only needed for ABI switch.</flag>
<flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag> <flag name="nscd">Build, and enable support for, the Name Service Cache Daemon</flag>